PDA

View Full Version : yet another multithreading example request



nkint
18th April 2013, 12:24
hi!
i am not an experienced programmer and
i´m going to develop a computer vision application and i have to write an application where:
1) a capture thread get an image from camera or from video file and put it in a buffer
2) a process thread get the image from buffer and process it

so it is a simple consumer/producer problem.. with a shared buffer.

even if i have some experience with c++ programming in computer vision i have never done anything with multi threading. i have read about qthread, qmutex, qsemaphore, qwaitconditions.. and everything is a big mess.
i don t understand where i have to use qmutex and where qsemaphore or where to use qwaitcondition and if i have to put toghether the threading system with signal and slots.. an real hell.
i´ve tried to do something but i have created a little program where after click ´run´ everything is blocking and nothing is shown.

multithreading is not my first target, because i have to handle some computer vision problem, so i want to spent less time possibile in it and focus on the real problem (the computer vision algorithm).
i´m looking for a simple example to do something like this.

i don´t need some sofisticated solution. only a processing thread that elaborate an image as soon as the buffer has it and. with the possibility of set the buffer capacity (only before starting) and the possibility to decide if the buffer is full what to do: drop the new frame from camera of drom the oldest frames in the buffer.

sorry if i repeat myself: i have to handle computer vision problem and threading is not my proble, i would spend in it as less time possible.
i just need something that can process heavy algorithm without blocking the gui and the video source

can someone point me to an already done example that do something similar?

Santosh Reddy
18th April 2013, 12:38
I hope you know how to get th Qt Docs and refer the examples there, any way here is simple example in Qt Centre Wiki http://www.qtcentre.org/wiki/index.php?title=Updating_GUI_from_QThread