HOW TO CONFIGURE Code::Blocks AND OpenCV ON LINUX
Transcription
HOW TO CONFIGURE Code::Blocks AND OpenCV ON LINUX
HOW TO CONFIGURE Code::Blocks AND OpenCV ON LINUX 1) Install Code::Blocks IDE on your system... more details here: http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks#Ubuntu 2) Create a new projekt on the main screen or choose File>New>Project (eg. a console application). First of all check the OpenCV installation path with these two commands: pkgconfig cflags opencv < shows the path of header files (step 4) pkgconfig libs opencv < shows the path of library files (step 3 and 5) 3) Open the Project>Build Options dialog an fill it the following way the Linker settings: The paths are known from the step 2 (you have to add FILES here, not only the directory). 4) In this dialog choose the Search directories and then the Compiler tab and add the path: 5) The last step: klick on the Linker tab, and here add the following row: 6) Try to build this simple program: #include "cv.h" #include "highgui.h" #include <stdio.h> int main( int argc, char** argv ) { CvCapture* capture = 0; IplImage *image = 0; if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0]))) capture = cvCaptureFromCAM( argc == 2 ? argv[1][0] '0' : 0 ); else if( argc == 2 ) capture = cvCaptureFromAVI( argv[1] ); if( !capture ) { fprintf(stderr,"Could not initialize capturing...\n"); return 1; } cvNamedWindow( "Input", CV_WINDOW_AUTOSIZE ); for(;;) { int c; image = cvQueryFrame( capture ); if( !image ) break; cvShowImage( "Input", image ); c = cvWaitKey(10); if( (char)c == 27 ) break; } cvReleaseCapture( &capture ); cvDestroyAllWindows(); return 0; } Dávid Losteiner @ 2007