lynix
lynix

Reputation: 145

C, GTK: display stream of RGB images at < 60 fps

I'm developing an application that shall receive images from a camera device and display them in a GTK window.

The camera delivers raw RGB images (3 bytes per pixel, no alpha channel, fixed size) at a varying frame rate (1-50 fps).

I've already done all that hardware stuff and now have a callback function that gets called with every new image captured by the camera.

What is the easyest but fast enough way to display those images in my window?

Here's what I already tried:

Currently I'm thinking about trying something like gstreamer and treating those images like a video stream, but I'm not sure whether this is like an overkill for my simple mechanism.

Thanks in advance for any advice!

Upvotes: 6

Views: 2470

Answers (2)

liberforce
liberforce

Reputation: 11454

unwind is right, cairo is the way to go if you want something that will work in GTK2 and GTK3. As your samples are RGB without alpha, you should use the CAIRO_FORMAT_RGB24 format. Make sure the surface you paint is in that format. Also try to make sure that you're not constantly allocating/destroying the surface buffer if the input image keeps the same size.

Upvotes: 1

unwind
unwind

Reputation: 400029

The entire GdkRGB API seems to be deprecated, so that's probably not the recommended way to solve this.

The same goes for the call to render a pixbuf. The documentation there points at Cairo, so the solution seems to be to continue investigating why your image looked incorrect when rendered by Cairo.

Upvotes: 4

Related Questions