kl3m3n's blog

Community Browser
Showing results for 
Search instead for 
Did you mean: 

OpenCV and Qt GUI CamShift tracker

Active Participant


before I move on displaying the data stream from Kinect as promised in the previous post, I have created another GUI example in Qt for OpenCV's CamShift tracking. The GUI shows the camera stream, where it is possible to interactively create a model for histogram backprojection. Based on this, the object is then tracked in real-time.

Figure 1 shows the GUI concept. The controls and indicators don't look very nice, because my Win 7 theme is set to classic.


Figure 1. GUI for CamShift tracker

Firstly, the "showRoi" button is used to select the histogram model from image stream, where the ROI position can be modified using the sliders. The backprojection image is also shown for the current ROI. After that, the "Track" button starts the object tracking using the hue-saturation histogram model based on the selected ROI. The backprojection image should have mostly whitish colors that correspond to the tracked object. The indicator below the backprojection image shows the position and the angle of the object.

The code is in the attached .zip file.

In order to get OpenCV working with Qt, check the previous post.

Best regards,



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."