tags:

views:

126

answers:

1
+1  Q: 

openCV on ubuntu

Hi,

What packages do I need to install openCV on ubuntu lucid 10.04 ? Do I need to do anything else to be able to compile a simple c example like setting an env variable or changing the path?

Is gcc a good compiler for openCV?

The example I'm trying to compile:

int main( int argc, char** argv ) {
IplImage* img = cvLoadImage( argv[1] );
cvNamedWindow( “Example1”, CV_WINDOW_AUTOSIZE );
cvShowImage( “Example1”, img );
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( “Example1” );

}

Thanks

+1  A: 

There is an opencv library package libcv4 and development files libcv-dev that should work.

Could also try installing from PPA to get very latest version 2.1 http://opencv.willowgarage.com/wiki/Ubuntu_Packages

The OpenCV documentation suggests using g++ to compile, see "Building your own code that uses OpenCV" http://opencv.willowgarage.com/wiki/InstallGuide

For example,

g++ -o my_example my_example.cpp -I<opencv_source_dir>/include[/opencv] \
        -L<cmake_binary_dir>/lib -lcxcore -lcv -lcvaux -lhighgui -lml
Mike Chelen