4

I'm working with ROS indigo on Ubuntu 14.04 LTS, which automatically installs OpenCV 2.4.8 on my Linux machine. I'm very new to how Ubuntu works, so I really don't want to mess with the OpenCV that's already installed on my machine.

I do however, want to see whether one of my programs still works with OpenCV 3.0, so I'd like to install OpenCV 3.0 and link to that instead in my CMakeLists.txt. Is there any way I an install OpenCV 3.0 without messing with the OpenCV 2.4.8 that's already on my machine so I can experiment with both?

Thanks

0

You should be able to just put the OpenCV download into a directory, run cmake there and make it. I have an old 2.2 from several years ago, but have no current experience, and the willowgarage link in the README is dead.

0

Go to OpenCV documentation here and follow the steps.

The only change is in Step 2. The cmake command should be modified to suit your needs:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX= ..

You existing installation should be in /usr/local, so use a different folder, for example you can create one in your home directory.

Here is how you compile with your new version of OpenCV:

Create a folder for your project. It should have the .cpp file and another file names CMakeLists.txt with the following contents:

CPP = g++

CPPFLAGS = -L</path/to/opencv3.0.0/lib> \
       -I</path/to/opencv3.0.0/include>

all: <name-of-.cpp-file>
     $(CPP) $(CPPFLAGS) $^ -o $@

There are three changes you need to make to this file. In the folder to which you installed OpenCV, there will be two directories by the name 'libs' and 'include'. You should put those in lines 2 and 3 respectively. Then in the second last line, put the name of your cpp file.

To compile your project, in a terminal, cd to you project folder and type make. The output binary file will be created in the same folder.

Source - StackOverflow

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.