This installation was tested on Ubuntu 12.04 with USB2.0 camera MU9.
Helpful links:
Building OpenCV version 3.1
Support page for OpenCV
Open page http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.10/
Download opencv-2.4.10.zip
unzip opencv-2.4.10.zip cd opencv-2.4.10
sudo apt-get install libgtk2.0-dev sudo apt-get install pkg-config
mkdir build cd build # on some systems "-D WITH_TIFF=NO" should be added to options cmake -D WITH_XIMEA=YES .. make
sudo make install
Create file opencv_test.cpp with following content
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
// A Simple Camera Capture Framework
int main()
{
CvCapture* capture = cvCaptureFromCAM( CV_CAP_XIAPI );
if ( !capture ) {
fprintf( stderr, "ERROR: capture is NULL \n" );
getchar();
return -1;
}
// Create a window in which the captured images will be presented
cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );
// Show the image captured from the camera in the window and repeat
while ( 1 ) {
// Get one frame
IplImage* frame = cvQueryFrame( capture );
if ( !frame ) {
fprintf( stderr, "ERROR: frame is null...\n" );
getchar();
break;
}
cvShowImage( "mywindow", frame );
// Do not release the frame!
//If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),
//remove higher bits using AND operator
if ( (cvWaitKey(10) & 255) == 27 ) break;
}
// Release the capture device housekeeping
cvReleaseCapture( &capture );
cvDestroyWindow( "mywindow" );
return 0;
}
g++ -I/usr/local/include/opencv opencv_test.cpp -lopencv_highgui -lopencv_videoio
Normal:
./a.out
Some environments needs to force library path:
LD_LIBRARY_PATH=/usr/local/lib ./a.out