zebeurton
zebeurton

Reputation: 319

Resize an image with OpenGL ES 2.0

My problem is simple: I have to process each frame of a video. The process computes a zone to crop on the original frame. To have better performances, I have to downscale the original frame. Nowadays, It is done thanks to a dedicated library. However, it is slow. We are wondering if there is any possibility to downscale this frame thanks to OpenGL ES 2.0 glsl.

David

Upvotes: 1

Views: 2409

Answers (2)

zebeurton
zebeurton

Reputation: 319

Finally, i Will use a frame buffer object to render my texture. I will set the viewport to desired size and render my texture as usual. To get back downsampled image, i Will use glGetReadPixels.

David

Upvotes: 0

Brad Larson
Brad Larson

Reputation: 170309

If you're using AV Foundation to load the video from disk or to pull video from the camera, you could use my open source GPUImage framework to handle the underlying OpenGL ES processing for you.

Specifically, you can use a GPUImageCropFilter to crop out a selected region of the input video using normalized 0.0-1.0 coordinates in a CGRect. The FilterShowcase example shows how this works in practice for live video from the camera. With this, you don't need to touch any manual OpenGL ES API calls if you don't want to.

Upvotes: 1

Related Questions