Frage

I would to apply the blur effect to a CameraOverlayController. I have found FXBlurView project. So, I have create a my UIImagePickerViewController and in the viewDidLoad I tried this code:

self.sourceType =
        UIImagePickerControllerSourceTypeCamera;
        self.mediaTypes = @[(NSString *) kUTTypeImage];
        self.allowsEditing = NO;
        self.showsCameraControls = NO;
        CGRect myFrame = CGRectMake(0, 0, 200, 480);
        UIImageView *overlay = [[UIImageView alloc] myFrame];
        UIImageView *testImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"iconExample"]];

        _blurView = [[FXBlurView alloc] initWithFrame:rect];
        _blurView.blurRadius = 6.0;
        _blurView.dynamic =YES;
        [overlay addSubview:testImage];
        [testImage addSubview:_blurView];
        self.cameraOverlayView = overlay;

But I have a problem... The result image is this...

enter image description here

in this image I see the correct icon green with blur effect ...but where there is blue color I not see the camera Image with blur effect... some suggestion?

War es hilfreich?

Lösung

Following this tutorial should tell you what you need to know:

http://www.raywenderlich.com/60968/ios-7-blur-effects-gpuimage

He shows how using the GPU-Image framework, you can blur a real time video-feed

Andere Tipps

I'm sorry but this approach won't work, the library relies on RenderToContext:, which won't work with the camera preview. Your best bet is to write custom camera code and blur it yourself.

See apple's Rosy Writer example code.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top