0

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?

Safari
  • 11,437
  • 24
  • 91
  • 191

2 Answers2

1

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.

Jack
  • 16,677
  • 8
  • 47
  • 51
1

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

Matthew Hallatt
  • 1,310
  • 12
  • 24