0% found this document useful (0 votes)
51 views

CodeBlocks OpenCV

This document provides instructions for configuring Code::Blocks IDE and OpenCV on Linux in 6 steps: 1. Install Code::Blocks IDE and check the OpenCV installation path using pkg-config commands. 2. Create a new project in Code::Blocks and fill the linker settings with the OpenCV library paths from step 1. 3. Add the OpenCV header file path to the compiler settings. 4. Add the OpenCV library files to the linker settings. 5. Try building a simple OpenCV program that captures video from a camera or file. 6. The document was written by Dávid Losteiner in 2007.

Uploaded by

Sumeet Jain
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

CodeBlocks OpenCV

This document provides instructions for configuring Code::Blocks IDE and OpenCV on Linux in 6 steps: 1. Install Code::Blocks IDE and check the OpenCV installation path using pkg-config commands. 2. Create a new project in Code::Blocks and fill the linker settings with the OpenCV library paths from step 1. 3. Add the OpenCV header file path to the compiler settings. 4. Add the OpenCV library files to the linker settings. 5. Try building a simple OpenCV program that captures video from a camera or file. 6. The document was written by Dávid Losteiner in 2007.

Uploaded by

Sumeet Jain
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

HOWTOCONFIGURECode::BlocksANDOpenCVONLINUX

1) InstallCode::BlocksIDEonyoursystem...moredetailshere:
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks#Ubuntu
2) CreateanewprojektonthemainscreenorchooseFile>New>Project(eg.aconsole
application).FirstofallchecktheOpenCVinstallationpathwiththesetwocommands:
pkgconfigcflagsopencv<showsthepathofheaderfiles(step4)
pkgconfiglibsopencv<showsthepathoflibraryfiles(step3and5)

3) OpentheProject>BuildOptionsdialoganfillitthefollowingwaytheLinkersettings:

Thepathsareknownfromthestep2(youhavetoaddFILEShere,notonlythedirectory).
4) InthisdialogchoosetheSearchdirectoriesandthentheCompilertabandaddthepath:

5) Thelaststep:klickontheLinkertab,andhereaddthefollowingrow:

6) Trytobuildthissimpleprogram:
#include"cv.h"
#include"highgui.h"
#include<stdio.h>
intmain(intargc,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);
elseif(argc==2)
capture=cvCaptureFromAVI(argv[1]);
if(!capture){
fprintf(stderr,"Couldnotinitializecapturing...\n");
return1;}
cvNamedWindow("Input",CV_WINDOW_AUTOSIZE);
for(;;){
intc;
image=cvQueryFrame(capture);
if(!image)
break;
cvShowImage("Input",image);
c=cvWaitKey(10);
if((char)c==27)
break;
}
cvReleaseCapture(&capture);
cvDestroyAllWindows();
return0;
}

DvidLosteiner@2007

You might also like