Thursday, February 2, 2012

Setting up opencv on DEV C++



This is really simple if you know what to do .

  1. Download OpenCV : install ; check the path where it is installed. for eg C:\Opencv2.x
  2. Download DevCPP: install ;

Once done with both
Open Dev Cpp.Go to TOOLS - COMPILER OPTIONS . ADD new compiler (click on plus sign).
Name it OpenCV.

Add these lines and tick
Add these foll commands while calling compiler
-L"C:\OpenCV\lib" -lcxcore210 -lcv210 -lcvaux210 -lhighgui210 -lml210

while doing so change the lib path( C:\OpenCV\lib) according to the path you have saved.GO to the lib folder in opencv dir and check for the above files linked .eg cxcore210 check if there is some other name instead and replace accordingly.


Add these lines and tick
Add these foll commands to the linker command line
-lcxcore210 -lcv210 -lcvaux210 -lhighgui210 -lml210


Now go to Directories

first in Binaries Add path to opencv Bin folder
C:\OpenCV\bin
again change it according to your bin path

then go to Libraries Add path to opencv Lib folder
C:\OpenCV\lib
again change it according to your lib path


then go to C includes Add path to opencv Include folder
C:\OpenCV\include
again change it according to your include path

then go to C++ includes Add path to opencv Include folder
C:\OpenCV\include
again change it according to your include path


Now go to Environment Variables and edit path variable
and add Opencv/bin to path and save.
Again the bin path should be according to your install dir opencv path. change it accordingly.




click ok and your are done .
go to samples and run them.
if u get errors
Make sure you have selected operating compiler as openCV.

Project -Project options - Compiler

cheers

18 comments:

  1. Hi.. just a suggestion, use ctrl+alt+prtsc to take the screen shot of the current active window.

    ReplyDelete
  2. for a simple program i'm getting the error lik this..error: `Mat' undeclared (first use in this function)

    ReplyDelete
  3. hi thanx fr the tut
    ther is no lib or bin folder inside opencv instead
    i hav lib and bin inside each of these folders C:\opencv\build\x86\ mingw, vc9, vc10 ,vc11

    which one i hav to choose inside them der are no specific named files as cxcore etc

    am using opencv 2.4.5

    plz help am new to cv

    ReplyDelete
    Replies
    1. Open vc9 vc10 or vc11 and you find lib and bin folder there

      Delete
  4. hey bro while i am going to do this thing in netbeans javacv.im getting error that's java.exe not found in correct directory.do you have any idea about this.

    ReplyDelete
  5. Hey bro is it necessary that openCV library should be in C drive??

    ReplyDelete
  6. can you please explain this point clearly:
    "while doing so change the lib path( C:\OpenCV\lib) according to the path you have saved.GO to the lib folder in opencv dir and check for the above files linked .eg cxcore210 check if there is some other name instead and replace accordingly."

    cant get it clear,,wat is it???

    ReplyDelete
    Replies
    1. Use path to open Cv folder of Your computer this is path to opencv folder on his computer

      Delete
  7. I followed all these steps but i am facing the same problem #include "opencv.hpp" No such directory or file.Compilation error.

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. The text written under Compiler Option=>compiler is Not clearly visible please write as a comment here

    ReplyDelete
  10. How can i read sample project from you?

    ReplyDelete
  11. There is no //lib or //bin folder

    ReplyDelete
  12. Slot Machine - DrmCD
    Slot Machine · 1. Megaways · 하남 출장샵 2. Wheel of Fortune · 3. Big Fish · 4. King Kong Deluxe Deluxe 구미 출장마사지 · 1xbet 먹튀 5. 세종특별자치 출장샵 Slot Machine · 속초 출장샵 6. King of Spades.

    ReplyDelete