Recommended way to draw raw pixel data at video rate


#1

Hi, I am building a library for camera input processing and I would like to expose an image preview for apps (including Juce apps) that use my library.

I am using OpenCV but I don’t want my client apps to care anything about it. So the way I have chosen to do this for now is to expose an unsigned char * (pointing to an array of pixel values) and provide the image height, image width, and channels (1, grayscale or 3, RGB) to the client.

What is the best way to preview this image (at 30 fps) in Juce? Keep in mind I am a Juce beginner. :slight_smile:

Thanks,
Matt


#2

I was working on a project of a similar nature a few years ago. I used OpenGL to render the video frames using Juce’s OpenGL component. All the source code from that project is publicly available here: http://sourceforge.net/projects/surfacetracker. And this class in particular did the OpenGL rendering:

http://surfacetracker.svn.sourceforge.net/viewvc/surfacetracker/src/OpenGLVideoDisplay.h?revision=15&view=markup
http://surfacetracker.svn.sourceforge.net/viewvc/surfacetracker/src/OpenGLVideoDisplay.cpp?revision=15&view=markup


#3

Yes, GL is probably the most efficient way to get the data across in a cross-platform way.