I found out the problem so I think I should post an answer here for the benefit of others who may have experienced the same problem.
Basically the binaries provided for OpenCv 2.2 by default do NOT include the Qt new functions. To enable it, one needs to download the OpenCv source and use CMake to generate makefiles and source that include the Qt new functions and compile the source from scratch.
Here are roughly the steps to do:
- First, install QT using the SDK from here:
http://qt.nokia.com/downloads/ . NOTE: You will need to add the QT libs and header files to your system path and to your linker path so that your compiler can locate them. It is NOT simply download and install. For windows, see: http://developer.qt.nokia.com/doc/qt-4.8/install-win.html to find out how to add the environment variables. You will need to set them up for CMake to detect QT and generate the proper files. For linux users, see: http://blog.sudobits.com/2010/06/30/how-to-install-qt-on-ubuntu-10-04/
- Download and install CMake from here:
http://cmake.org/cmake/resources/software.html .
- Download OpenCV's source code for your OS from here:
http://opencv.willowgarage.com/wiki/
- Now run the GUI of CMake and use it to select the folder where you
have extracted the OpenCV source. Select the type of OS you are
compiling for i.e. Unix Makefiles, Visual Studio solution, XCode
etc.
- Now a list of options should appear. There will be an option for QT
as well as QT with openGL. Select the first and the one with openGL
if you require it. Next, click the "configure" button followed by "generate" button in
CMake. The necessary project files would then be generated.
- Depending on the
type of project you created (Unix Makefiles, Visual Studio project
etc.), you can now go to the folder where they are generated by
CMake and compile the project. For e.g. if you chose CMake to
generate Visual Studio solution, there would be a Visual Studio
solution file in the folder. Open it and select Build All. If you
chose Unix Makefiles just call "make" at the command line followed by "sudo make install".
- Now all you need is the libraries in the /lib folder and the header
files in the /include folder. Copy this 2 folders to whereever you
wish to place them. For e.g. on Ubuntu, after you have typed "sudo make
install" they would have been automatically copied to /usr/local/lib
and /usr/local/include. For windows user, they would be in the
folder you specified in CMake.
- To link your project (be it visual studio or using make in unix),
you have to tell your linker where to find the libs and include
files. You specify them as you would when you downloaded the OpenCV
binaries.
Thats it. You should now have a working OpenCV with QT.
Instructions on how to compile from scratch is given on OpenCv's webpage here: http://opencv.willowgarage.com/wiki/InstallGuide.