Friday, 29 January 2016

Running openCV

Running Programs in openCV:

There are many ways to run .c or .cpp programs in opencv you can use the methods specified in the homepage.
I am following the method mentioned in the opencv homepage for using gcc and eclipse

Using Cmake:
To run opencv programs one must now:

  • Create a project folderi.e.,say a program 'proj_name.cpp' is to be created compiled and executed. Create a Folder proj_name (This is only for convinence sake). Create the source file proj_name.cpp
  • Create a .txt file named "CMakeLists.txt" and it must contain the following
cmake_minimum_required(VERSION 2.8)
project( proj_name )
find_package( OpenCV REQUIRED )
add_executable( proj_name proj_name.cpp )
target_link_libraries( proj_name ${OpenCV_LIBS} )



  • Now to compile and create an executable object use the following commands:

cd <DisplayImage_directory>
cmake .
make

4)After compiling you will get an executeable object. To run the code use the command


./proj_name     any_parameter_needed



any_parameter_needed varies depending on your program

Using eclipse(C/C++):
I am following the method mentioned in the opencv homepage

No comments:

Post a Comment