GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

Photos taken with front camera often have visual glitches

Open jim-rhoades opened this issue 14 years ago • 6 comments

With the SimplePhotoFilter app, if I use the front camera by calling "rotateCamera" right after allocating GPUImageStillCamera...

stillCamera = [[GPUImageStillCamera alloc] init];
[stillCamera rotateCamera];

... photos taken often have visible glitches in them. (on an iPhone 4S with iOS 5)

The problem might be related to this issue, as forcing GPUImageOpenGLESContext's +supportsFastTextureUpload to return NO fixes it: https://github.com/BradLarson/GPUImage/issues/71#issuecomment-5248730

If possible, can you confirm that this is the same issue, and that I'll need to force supportsFastTextureUpload to return NO if I want to use the front camera in my app?

Thanks :)

jim-rhoades avatar May 09 '12 03:05 jim-rhoades

I don't know that the still camera input was intended for use with the front-facing camera. You could try to simply use a video camera source from the front camera and capture still images using -imageFromCurrentlyProcessedOutput on the last filter in the chain.

I'll see if that's the cause, or if there's something else wrong here.

BradLarson avatar May 09 '12 17:05 BradLarson

had the same issue when I used Photo preset. Now I do the same thing that you have described but not getting the camera shutter sound :( ... the problem is the same as this: http://www.fuerteint.com/_files/GPUImage/photo1.JPG (#71)

rafiki270 avatar May 09 '12 23:05 rafiki270

I had the same exact problem. In the GPUImageStillCamera.m, I commented out "[self captureOutput:photoOutput didOutputSampleBuffer:imageSampleBuffer fromConnection:[[photoOutput connections] objectAtIndex:0]];" and now the glitches are gone. That's the only way I was able to fix the problem without forcing GPUImageOpenGLESContext's +supportsFastTextureUpload to return NO.

jacobcaraballo avatar May 18 '12 06:05 jacobcaraballo

That's actually a decent solution, if you have a conditional check to only do that for the front camera. The front camera always returns frames that are the same size as the photos it takes, so by using the results from the previous preview image, you're going to be almost identical to the frame grabbed when requesting a photo.

I'll see about rolling something like this into the framework.

BradLarson avatar May 18 '12 13:05 BradLarson

OK, I rolled that workaround into the main framework code. It should check to see if you're capturing from the front camera while using the texture caches, and use the previous video frame for that. In all other cases, it will process as normal. This should prevent this kind of image corruption from showing up in these photos.

BradLarson avatar May 18 '12 14:05 BradLarson

That works, thanks for the fix.

jim-rhoades avatar May 19 '12 02:05 jim-rhoades