Re: Using a GSource to dispatch camera images to display in a GUI



Hi Luis,

On 10/02/2008, Luis Menina <liberforce freeside fr> wrote:
I'm currently hacking on a system that can analyse images coming from a
camera (on the fly), or from a pre-recorded set of images
(pos-analysis). I want to be able to use either source transparently.
But as I don't know how much time the pre-recorded images will take to
process, I'd like to have the processing be asynchronous.

I've done a couple of camera GUI projects. I'd suggest the following structure:

- have a thread grabbing the camera frames and doing something (very
simple) with them
- I had two modes in one project: a little processing plus write to
disc, or a little processing and update current frame
- have a timeout in the main thread and at some standard rate (10
times a sec?) queue a redraw of the GtkDrawingArea that shows the
camera field
- in the DrawingArea expose, repaint using the 'current frame' left by
the background grab thread (you'll need a mutex here)

The advantage of this is that the soft real-time stuff (grab all the
video) is in a separate thread from the GUI, so it should be hard to
miss frames, and the timeout should ensure that you don't spend so
much time repainting that the GUI freezes.

John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]