Configuration of Dev-C++
OpenCV - OpenCV is a computer vision library originally developed by Intel. It is free for commercial and research use under the open source BSD license.OpenCV provides cross-platform middle-to-high level API that includes about 300 C functions and a few C++ classes. Also there are constantly improving Python bindings to OpenCV, see interfaces/swig/python and samples/python. OpenCV has no strict dependencies on external libraries, though it can use some (such as libjpeg, ffmpeg, GTK+ etc.).
I found opencv very fast as compared to other image processing libraries namely the tool box provided by MATLAB. But to use it you have to learn how to link it in you favorite IDE. In this post I am posting the linking of opencv library in my favorite IDE DEVC++ by BloodShed. Bloodshed Dev-C++ is distributed under the GNU General Public License. and free for use as compared to Microsoft's VisualC++. Moreover it produces a minimal no of file while compiling. One other feature of DEVc++ is that it is easy to link opencv in it.
For this tutorial I assume that you have installed opencv in C:\ drive of WINDOWS.
[NOTE- For OpenCV 2 or Higher versions see here how to integrate it with DEV C++ ]
In Dev-C++ open the menu "Tools->Compiler options".
In the first tab("Compiler") you need to check the box "Add these commands to the linker command line" and type the following line in the text bow below:
-lhighgui -lcv -lcxcore -lcvaux -lcvcam
Go to the sub-tab "Libraries" in the tab "Directories" and add there C:\Program Files\OpenCV\lib to the paths:
Now switch to the sub-tabs "C Includes" and "C++ Includes" and add this paths:
C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\cv\include
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\cvaux\include
C:\Program Files\OpenCV\otherlibs\cvcam\include
OpenCV - OpenCV is a computer vision library originally developed by Intel. It is free for commercial and research use under the open source BSD license.OpenCV provides cross-platform middle-to-high level API that includes about 300 C functions and a few C++ classes. Also there are constantly improving Python bindings to OpenCV, see interfaces/swig/python and samples/python. OpenCV has no strict dependencies on external libraries, though it can use some (such as libjpeg, ffmpeg, GTK+ etc.).
I found opencv very fast as compared to other image processing libraries namely the tool box provided by MATLAB. But to use it you have to learn how to link it in you favorite IDE. In this post I am posting the linking of opencv library in my favorite IDE DEVC++ by BloodShed. Bloodshed Dev-C++ is distributed under the GNU General Public License. and free for use as compared to Microsoft's VisualC++. Moreover it produces a minimal no of file while compiling. One other feature of DEVc++ is that it is easy to link opencv in it.
For this tutorial I assume that you have installed opencv in C:\ drive of WINDOWS.
[NOTE- For OpenCV 2 or Higher versions see here how to integrate it with DEV C++ ]
In Dev-C++ open the menu "Tools->Compiler options".
In the first tab("Compiler") you need to check the box "Add these commands to the linker command line" and type the following line in the text bow below:
-lhighgui -lcv -lcxcore -lcvaux -lcvcam
Go to the sub-tab "Libraries" in the tab "Directories" and add there C:\Program Files\OpenCV\lib to the paths:
Now switch to the sub-tabs "C Includes" and "C++ Includes" and add this paths:
C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\cv\include
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\cvaux\include
C:\Program Files\OpenCV\otherlibs\cvcam\include
hi..
ReplyDeletei hav done wat u hav shown above, but i m getting a problem.. its showing "cannot find -lhighgui" and "ld returned 1 exit status".. can u plz suggest me wat to do???
hi Akhil ... this may be because the highgui library may be missing. Try to find that you are giving correct path for your opencv directory.
ReplyDeletemy opevCV does not have C:\Program Files\OpenCV\otherlibs\cvcam\include. later i copied cvcam.h into that location and tried. still dev-c++ shows compiling errors
ReplyDeleteOpenCV Version 2.0 does not install in Program Files directory, instead it goes into C:\OpenCV2.0\ folders.
ReplyDelete1. Add a compiler to the default compiler (Call it any name.. OpenCV is a good option)
2. Check "Add these commands to the linker command line" and add the following commands:
-llibcxcore200 -llibcv200 -llibcvaux200 -llibhighgui200 -llibml200
3. In the directories.. add the following lines and move them to the top (using arrow)
a. C++ Includes: C:\OpenCV2.0\include\opencv
b. C Includes: C:\OpenCV2.0\include\opencv
c. Libraries: C:\OpenCV2.0\lib
d. Binaries: C:\OpenCV2.0\bin
Also fix the cxoperations.hpp file in accordance with the last paragraph on the install guide.
ReplyDeleteDevCPP = MinGW.
http://opencv.willowgarage.com/wiki/InstallGuide
Open cxoperations.hpp (found in \include\opencv)
Find this section (lines 67-68 in 2.0):
#else
#include
#if __GNUC__ >= 4
And update it to reference a new definition, __MINGW32__ (defined by the MinGW compiler, see http://predef.sourceforge.net/precomp.html#sec31):
#else
#include
#if __GNUC__ >= 4 || __MINGW32__
@HI -- PrAtAp VaRdHaN ... Only cvcam.h will not work, as there are many other files such as dll files the directory. So the best way is to reinstall the application ie OpenCV library.
ReplyDeleteHi Aeronaut... You are rigth. I have not worked with openCV V2. But when I tried to install it for my face recognition project I found it too. Thankx.
ReplyDeleteHi,
ReplyDeleteI'm working with openCV 2.1 and have follow all the instructions you stated above including changing the library version from 200 to 210. but i still facing the same problem like akhil. please help me. tq
i am compiling opencv2.1 i am getting an error that
ReplyDelete[Linker error] undefined reference to `__cpu_features_init'
can anybody help?
i have some problem of my OpenCV library, wen i compile it, the error is "Application is failed to initialized"...plz help to solve this problem,im a computer science student from Philippines, Davao City...tnx
ReplyDeletemy project is predicting ripening stages of a papaya using color histogram method...
ReplyDeletei followed the given procedure.while compiling a simple program i am getting this error
ReplyDelete2123 C:\OpenCV2.0\include\opencv\cxcore.hpp:2243, from C:\OpenCV2.0\include\opencv\cxcore.h In file included from C:/OpenCV2.0/include/opencv/cxcore.hpp:2243, from C:/OpenCV2.0/include/opencv/cxcore.h
47 C:\OpenCV2.0\include\opencv\cxcore.h:2123, from C:\OpenCV2.0\include\opencv\highgui.h from C:/OpenCV2.0/include/opencv/cxcore.h:2123, from C:/OpenCV2.0/include/opencv/highgui.h
and many similar errors....
hello
ReplyDeleteritesh can u tell me how i can integrate OpenCV with VC++
See - http://programing-tutorial.blogspot.com/2009/10/linking-and-configuring-opencv-with.html
ReplyDeleteand http://programing-tutorial.blogspot.com/2009/10/open-cv-tutorial-sample-program-and.html
For OpenCv2.0, please include "|| __MINGW32__" under cxoperations.hpp like:
ReplyDelete#include
#if __GNUC__ >= 4 || __MINGW32__
#define CV_XADD _
This is an important final step - you need it to get it working in addition to the steps listed above.
The above comment was for Dev C++ IDE.
ReplyDeleteHi , compilers
ReplyDelete---------------------
can Any body help me
I am using devc++ & openCV242
I can't Linking OpenCV library in DEVC++ & I don't find cxoperations.hpp
-----------------------------------------------
Please Help me
Thank You ,
Abbods
Thank you for sharing this piece of info. I posted an informative research from opencv c++ face detection developers and programmers here. Do not hesitate to ask me questions.
ReplyDelete