Double installation of OpenCV 2.4.9

asked 2014-09-12 06:36:22 -0600

Metalzero2 gravatar image

updated 2014-09-12 09:17:08 -0600

So let me start from the beggining.

I used to have Ubuntu 12.04 and OpenCV 2.4.8. I made some programes back then and have saved them. I am now using Ubuntu 14.04 64-bit and installed OpenCV2.4.9. I installed OpenCV 2.4.9 and most of the programmes I had worked just fine. Then I was trying to use ROS but got an error when trying to use the nonfree module (although out of ROS it worked find). I could not find any help so I tried to uninstall and re install OpenCV2.4.9.

I uninstalled OpenCV by going to the build I made and running "make uninstall". It ran fine and I thought it was uninstalled. I when and installed opencv 2.4.9 again (by using the CMake and source from

Now look what I have:

1)in "/usr/include/opencv2" I have all the modules (folders with .h and .hcc files in them) except "nonfree" and "viz"

2)in "/usr/local/include/opencv2" I have all modules in there (+ nonfree and viz)

3)in "/usr/local/lib" I can find the "linker name", "soname" and "real name" for opencv. For example I see "", "" and "". How can I be sure they are looking at the correct place?

The thing is that when I run code it is looking that the /usr/include/opencv2 location. I think this to be true because after I thought I uninstalled opencv I when and installed opencv a again (the second time). I did something wrong and the folders in /usr/local/include/opencv2 was there with folders that had the modules name but with no code in them (I found this out later). Although OpenCV was not installed right the second time, the code that did not include nonfree in it, was able to run fine (when I tried). Then I installed it correctly and now I have openCV installed in two places (as I said above).

I want to get read of the code from one place and keep it in the second place with the nonfree module included. What can I do to fix this problem? Where is it better for the code to be installed in?

edit retag flag offensive close merge delete


did you try changing the environment variable $OpenCV_INCLUDE_DIRS ?

JewelCV gravatar imageJewelCV ( 2014-09-13 04:27:51 -0600 )edit

@JewelCV What do you mean to change the OpenCV_INCLUDE_DIRS? You meant when I built OpenCV? What should I change it to?

Metalzero2 gravatar imageMetalzero2 ( 2014-09-13 09:50:48 -0600 )edit