Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install OpenCV in ubuntu 12.04

I already have OpenCV2.4.2 installed as part of ROS(Fuerte) in my computer(installed from Ubuntu Software Center, something due to ROS). How should I install OpenCV as a standalone?

I went through this guide and downloaded the opencv package from here. I am not quite clear as how to proceed. Can anyone give short list of steps to install? I want to use an IDE for my projects, so which IDE is proper for C++ and how to install the proper IDE and configure it correctly?

Also how to check if certain tools are installed?

like image 246
Karthik Murugan Avatar asked Feb 16 '13 14:02

Karthik Murugan


People also ask

Can I install OpenCV using pip?

OpenCV can be installed using pip. The following command is run in the command prompt to install OpenCV. This command will start downloading and installing packages related to the OpenCV library. Once done, the message of successful installation will be displayed.


Video Answer


1 Answers

This link which you also mentioned describes the necessary steps to compile OpenCV on your machine. The version of OpenCV you install this way will be newer than the one installed with the ROS package, they usually have some delay. (Maybe not with Fuerte.)

Using multiple versions of the same library on a machine might cause problems with linking and it will create a bit of headache for you so I would avoid it.

Try running pkg-config opencv --libs to see if the ROS version pulled by Fuerte is available and you can use this with your projects later on.

For a starter IDE I would recommend Qt Creator. The easy way to set OpenCV up with your project in Qt Creator is the following:

  1. Create a project
  2. Open the .pro file of the project
  3. Run pkg-config opencv --cflags
  4. Add this to the .pro file: INCLUDEPATH += __result__of__above
  5. pkg-config opencv --libs
  6. Add this to the .pro file: LIBS += __result__of__above

In the end what you add should look something like this:

INCLUDEPATH += -I/opt/ros/fuerte/include

LIBS += -L/opt/ros/fuerte/lib -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_ts -lopencv_video -lopencv_videostab

like image 113
BenceMagyar Avatar answered Nov 16 '22 02:11

BenceMagyar