Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Sunday, September 22, 2013

Creating OpenCV project using Eclipse on Ubuntu

Hi
Hope you are already have installed Eclipse, g++ and OpenCV. If not, then go to my article, and see how it can be done.
Today, we are going to create our first "hello world" application using OpenCV and Eclipse.

  • Run Eclipse
  • Create Empty C++ project

  • Add Source folder into the project,  I call it- "src"
  • Add new "HelloWorld.cpp" into "src" folder.



  • Open terminal window and type "pkg-config opencv --cflags". It will show you paths to OpenCV

  • Right click on your Project folder.
  • Select "Properties" item
  • In the  Property window go to "C/C++ Build- Settings- Includes" and put there paths to OpenCV libs that you  obtained using pkg-config tool


  • Click "Apply" button to save your changes.
  • Switch back to your  terminal window and type "pkg-config opencv --libs" It will show you list of libs registered  in system for OpenCV

  • Switch to Eclipse again.
  • Go to "C/C++ Build- Settings- GCC C++ Linker- Libraries"
  • In the Libraries (-l) list add all libraries  hat you have got in your terminal window. Each Library should be described from new line.
  • In the "Library Search path (-L)" add paths to OpenCV libs  that you can see in terminal window.


Click OK Button, to  close Property window.
That's all, your project configured and ready to  work with OpenCV.
  • Go to your OpenCV/sample/cpp folder, select any cpp file, copy content into your "HelloWorld.cpp"
  • Press "Ctrl+B" to build  your project
  • Run it.




Saturday, September 21, 2013

Installing OpenCV on Ubuntu 12.04

Hi,
Today we are going to Install OpenCV  on Ubuntu.
Here  is list of  our upcomming steps:

  1. Check  for updates
  2. Install updates
  3. Install required modules
  4. Download OpenCV 
  5. Compile OpenCV
Lets start.
Run "Terminal"

Type "sudo apt-get update"

Type "sudo apt-get upgrade"

Type: "sudo apt-get install g++". We will use C++ compiler for  our OpenCV projects

Type "sudo apt-get install cmake"


Type: "sudo apt-get install libgtk2.0-dev"

Type: "sudo apt-get install python-numpy"


Go to your favorite  browser and download OpenCV for Linux

Extact content into Home folder


Switch back to your terminal window
change directory to your newly extracted OpenCV folder. In my case it's "/Home/maks/opencv-2.4.6.1"
Type: "cd opencv-2.4.6.1"




Type: "cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_NEW_PYTHON_SUPPORT=ON -D CMAKE_INSTALL_PREFIX=/usr/local ./"

Type: "make"

Type "sudo make install"



If you still don't have Eclipse IDE, then type "sudo apt-get install eclipse"


After  eclipse have been successfully installed, we have to install CDT extension
Type: "sudo apt-get install eclipse eclipse-cdt" 


Type "eclipse" and  you are ready to go.


That's all folks, now you can start Eclipse and write your awesome computer vision  apps using OpenCV.