Ubuntu: How to install OpenCV 3.0.0 and 2.4?



Question:

I know that a lot of questions have been posted regarding the installation of OpenCV, but right now I need to install both OpenCV 2.4 along with OpenCV 3.0.0

Since there are a lot of research codes available online and the authors of these say that our code is not compatible with OpenCV 3.0.0, I am wondering how can I install both versions of OpenCV.

Even before the installation instructions, can somebody please tell me how to remove all the existing versions of OpenCV from my PC. I want to do a clean installation of OpenCV, with appropriate setting of all the environment variables.

Thanks in Advance.


Solution:1

Run command: sudo apt-get remove opencv.

This will uninstall the opencv and then delete the opencv folder from home, that's it.


Solution:2

Only gives you one at a time; You can compile both versions, and keep the compiled code in the build folders. When you want to use a specific version, run sudo make -j 4 install in that build folder.


Solution:3

To uninstall OpenCV, you have 2 options depending on how you installed it:

  1. If you installed it with apt-get, run: sudo apt-get remove opencv.
  2. If you compiled it by your own, I think it was something like (sudo) make uninstall in the directory where you did make and make install (usually build/).

Both will uninstall OpenCV (in the later case it will still leave you the local folder you used to compile it, so you can re-compile or re-install it at any moment).

To install both OpenCV versions. I dumb trick I did was to prepare 2 OpenCV compilation folders (one for each version). And then a bash script program that performs make uninstall on one folder and make install on the other one. It should take it ~15 seconds to switch the OpenCV version on this way, since both version will be already locally compiled.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »