Skip to content

Updating OpenCV

Vinícius Brito Cardoso edited this page Oct 1, 2018 · 2 revisions

There are two options when updating OpenCV. The old version can be completely removed, or the two can coexist but only one active at the time. This tutorial will cover both options, but keep in mind that CARMEN will be using 3.1 from now on.

Removing the old version

The procedure depends on the method used to install OpenCV.

From repository

In this case only the following command is necessary to remove it.

sudo apt-get purge libopencv*

From source

Navigate to the folder where the installation was performed:

cd /usr/local/opencv-2.4.9/build

Now uninstall it:

sudo make uninstall

Now proceed to install the newer version.

Keep old version (optional):

In the case you want to keep multiple versions of OpenCV, there is a script called cvswitch that will do the job for you. First clone the repository:

cd ~/
git clone https://github.com/uavster/cvswitch

Now edit your .bashrc file:

gedit .bashrc

Add to it's end:

#CVSwitch
export PATH=~/cvswitch:$PATH

Now the script is installed. Just follow the workflow example and remember to always try cvswitch list after saving an version to check if it really saved. To install the OpenCV 3.1 use this guide.

Clone this wiki locally