Thursday, February 24, 2011

qt-opencv-multithreaded: v1.12 Released

A custom ROI set with canny edge detection on.

This multithreaded Qt-based OpenCV application was first released mid-January this year on Google Code (here) and since then a few minor changes (mostly coding style and GUI-related) to the original application have been made.

This program was originally written to serve as basic "framework" application for my undergraduate project which required the tracking of multiple moving objects (using OpenCV). The initial implementation of the tracking program simply used a large "while" loop which first captured a frame from the camera and then performed image processing on it - a sequential process. It soon became apparent that as the image processing became quite intensive, not only did the responsiveness of the Qt-based GUI suffer, but the frame processing rate also decreased drastically (resulting in "dropped" frames).

As a result of this, I decided to re-write the entire tracking program from scratch using separate threads for the capturing of frames from the camera and the image processing. This was a logical decision considering the increasing popularity (and low cost!) of multi-core processors in both laptops and desktops nowadays.

I have intentionally kept this program quite simple so it can be easily modified to suit the needs of any Qt GUI-based computer vision project using OpenCV. Several in-built (and user-settable) OpenCV image processing functions have also been included so that multithreading performance can be assessed (see full list of features here).

In short, this application takes advantage of multithreading to allow frames to be captured from the camera while at the same time performing image processing. In other words, once a frame has been captured from the camera, the application does not have to wait until image processing is performed on that frame before it starts capturing a new frame - instead a new frame is captured, added to a FIFO queue and is processed a short time later.

Please go to the project page at Google Code to download and for more details (including installation and usage instructions). Any feedback/suggestions/questions concerning this "framework" application would be greatly appreciated. I hope it serves as a basis for many interesting computer vision projects in the future!

Processing Settings dialog used to customize the in-built OpenCV functions.