Compile and Config OpenCV for Eclipse C++

by November 23, 2016 0 comments
The steps are:
  1. Download CMake and install it (in the installation wizard choose to add CMake to the system PATH).
  2. Download the 'release' version of OpenCV.
  3. Extract the archive to a directory of your choice. I will be using c:/opencv/.
  4. Launch CMake GUI.
    1. Browse for the source directory c:/opencv/.
    2. Choose where to build the binaries. I chose c:/opencv/release.
      CMake Configuration - 1
    3. Click 'Configure'. In the screen that opens choose the generator according to your compiler. In our case it's 'MinGW Makefiles'.
      CMake Configuration - 2
    4. Wait for everything to load, afterwards you will see this screen:
      CMake Configuration - 3
    5. Change the settings if you want, or leave the defaults. When you're done, press 'Configure' again. You should see 'Configuration done' at the log window, and the red background should disappear from all the cells.
      CMake Configuration - 4
    6. At this point CMake is ready to generate the makefile with which we will compile OpenCV with our compiler. Click 'Generate' and wait for the makefile to be generated. When the process is finished you should see 'Generating done'. From this point we will no longer need CMake.
  5. Open MinGW shell (The following steps can also be done from Windows' command prompt).
    1. Enter the directory c:/opencv/release/.
    2. Type mingw32-make and press enter. This should start the compilation process.
      MinGW Make
      MinGW Make - Compilation
    3. When the compilation is done OpenCV's binaries are ready to be used.
    4. For convenience, we should add the directory C:/opencv/release/bin to the system PATH. This will make sure our programs can find the needed DLL's to run.
  6. Config in Eclipse
    1. Project properties => GCC C++ Compiler => Includes, add this as new line "C:\opencv_2_4_13\build\include"
    2. In MinGW Linker, add these lines at Libraries 

libopencv_contrib2413
libopencv_core2413
libopencv_features2d2413
libopencv_flann2413
libopencv_gpu2413
libopencv_highgui2413
libopencv_imgproc2413
libopencv_legacy2413
libopencv_ml2413
libopencv_nonfree2413
libopencv_objdetect2413
libopencv_photo2413
libopencv_stitching2413
libopencv_ts2413
libopencv_video2413
libopencv_videostab2413

          And "C:\opencv_2_4_13\{your_build}\lib" in Libraby search
Done.

An Nguyen

Developer

Sharing daily exciting lesson learned and posts about .NET, SQL Server, HTML, Javascript - jQuery, CSS - Bootstrap, SalesForce CRM, Kentico CMS and so on.

0 comments :

Post a Comment