First, Qt has been successfully installed in linux, and I use Ubuntu10. Next I will talk about it in this environment, if there are differences, install them according to the specific version. First, open Ubuntu10.10's Software Center, as shown in. Click Ubuntu Software Center. The following window appears. Enter opencv in the search box in the upper right corner. Many related software installations are displayed, except for the first one, after installation
First, Qt has been successfully installed in linux, and I use Ubuntu10. Next I will talk about it in this environment, if there are differences, install them according to the specific version.
First, open the Software Center of Ubuntu 10.10, as shown in:
Click Ubuntu Software Center. The following window is displayed.
Enter opencv in the search box in the upper right corner to display a lot of related installation software. Except for the first one, it has no effect on the running program.
After installation, enter the following command in the command line: sudo gedit/usr/share/qt4/mkspecs/default/qmake. conf.
The following two sentences are added to the file:
QMAKE_INCDIR =/usr/include/opencv
QMAKE_LIBS =-lcvaux-lcv-lcxcore-lhighgui-lml
The following example is used to test whether the installation is successful:
# Include
# Include
Int main ()
{
IplImage * img = 0;
Img = cvLoadImage ("test.jpg",-1); // test.jpg is under the directory of the project created
CvNamedWindow ("test", 1 );
CvShowImage ("test", img );
CvWaitKey (0 );
Return 0;
}
Step 1: qmake-project
Step 2: qmake
Step 3: Open the XXX. pro file and run the command vi XXX. pro to add the following content:
INCLUDEPATH + =/usr/include/opencv
LIBS + =/usr/lib/libcv. so \
/Usr/lib/libcvaux. so \
/Usr/lib/libcxcore. so \
/Usr/lib/libhighgui. so \
/Usr/lib/libml. so
Step 4: make
Step 5: run the command:./XXX to check whether the image is successfully output.