GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

Feature Request: GPUImageStillImageCamera uses lower res preview

Open powellmark opened this issue 14 years ago • 6 comments

Using GPUImageStillCamera to update a GPUImageView is not particularly fast. This appears to be because each frame frame the camera is the full resolution of the camera. Thus, we are applying filters to huge images during use of the app (when all we need the full version for is the final product).

Would it be possible to have the GPUImageStillCamera at a lower resolution and switch to the StillCamera resolution only on capturePhotoAs* methods?

Not sure the best way to handle AVCaptureSessionPresets or if it's even possible.

powellmark avatar Aug 23 '12 16:08 powellmark

@powellmark So being able to capture a preview at the resolution that is displayed on the screen, as well as the full image when needed? This would "speed up" capture (in the user's perspective) by at least a couple seconds each time I imagine.

dmitric avatar Aug 23 '12 16:08 dmitric

Yes, so during the live capture to a GPUImageView it's lower resolution, and only full resolution on a capture Photo call.

powellmark avatar Aug 23 '12 16:08 powellmark

The actual image resolution for the video preview from the still camera is 852x640 on an iPhone 4 / 4S. This is what is returned from the hardware, not the full image frame. The full photo is only returned in response to the asynchronous photo capture callback. If I was getting full frame photos with every preview frame, the video would be a slideshow.

Instead, the reason that you see a 20 FPS video feed on the still image preview vs. the 30 FPS for the video camera is that this is what the hardware's maximum preview capture speed is. A different sensor is being used (note the difference in field of view between the video camera and the photo preview camera), which has a lower framerate.

There's nothing I can do about this, because this is a hardware limitation of current devices. Note that the built-in camera application on iOS has the same slower preview framerate as compared to the video camera.

BradLarson avatar Aug 23 '12 17:08 BradLarson

Sorry for the dumb question, but is there anyway to grab a frame from the still camera preview, not just the async photo callback? I briefly tested using a UIGraphics(Begin/End)ImageContext but it didn't seem to work.

dmitric avatar Aug 23 '12 17:08 dmitric

You can grab an image from a video feed at any time by using the -imageFromCurrentlyProcessedOutput method (and its derivatives) on the last filter in your chain (or any earlier filter if you just want the result up to that point). This works on both the still photo preview or the feed from a video camera.

This will give you an image at the current resolution, so it won't be the same as using the photo capture callbacks.

BradLarson avatar Aug 23 '12 17:08 BradLarson

Hey @BradLarson, i am experiencing the 20fps issue but i have a toggle that switches to video giving me 30fps and when I switch back to photo it shows 30fps as well. I can get 30fps for the still camera after I switch to video and then back again to still camera. So its very possible to get 30fps from the preview, but it is not initializing that way you have to make the switch and back again. Any ideas as to why and how to trigger 30fps out of the gate? last time this was mentioned was 2 years ago and im using a iphone 5

joshreeder avatar Mar 19 '14 02:03 joshreeder