Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>To expand upon what Tommy said, you'll want to use AVFoundation in iOS 4.0 to capture the live camera frames. However, I'd recommend using OpenGL directly to do the image processing because you won't be able to achieve realtime results on current hardware otherwise.</p> <p>For OpenGL ES 1.1 devices, I'd look at using Apple's <a href="http://developer.apple.com/library/ios/#samplecode/GLImageProcessing/Introduction/Intro.html" rel="nofollow">GLImageProcessing</a> sample application as a base (it has an OpenGL greyscale filter within it) and running your live video frames through that.</p> <p><strike>For OpenGL ES 2.0, you might want to use a programmable shader to achieve this effect. I show how to process live iPhone camera data through various filters in <a href="http://www.sunsetlakesoftware.com/sites/default/files/ColorTracking.zip" rel="nofollow">this sample application</a> using shaders, with a writeup on how that works <a href="http://www.sunsetlakesoftware.com/2010/10/22/gpu-accelerated-video-processing-mac-and-ios" rel="nofollow">here</a>.</p> <p>In my benchmarks, the iPhone 4 can do this processing at 60 FPS with programmable shaders, but you only get about 4 FPS if you rely on CPU-bound code to do this.</strike></p> <p>Since I wrote the above, I've now created <a href="https://github.com/BradLarson/GPUImage" rel="nofollow">an open source framework</a> that encapsulates this OpenGL ES 2.0 video processing, and it has a built-in grayscale filter that you can use for this. You can use a GPUImageGrayscaleFilter applied to a video source to do a fast conversion to black and white, or a GPUImageSaturationFilter to selectively desaturate this video by a controlled amount. Look at the SimpleVideoFilter example so see how this can be applied to a live video feed, then recorded to disk.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload