Installing OpenCV for C++ and Python

Copying the instructions from my awesome robotics professor Paul Ruvolo from here so I don’t lose these steps:

To install OpenCV, go ahead and type each of these steps into your terminal window. Note that the “make” step will take forever, so go grab some popcorn or tea once you get there.

$ cd /tmp
$ wget https://github.com/Itseez/opencv/archive/2.4.11.zip
$ unzip 2.4.11.zip
$ cd opencv-2.4.11
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_BUILD_TYPE=RELEASE \
-DBUILD_PYTHON_SUPPORT=ON \
-DWITH_XINE=ON \
-DWITH_OPENGL=ON \
-DWITH_TBB=ON \
-DBUILD_EXAMPLES=ON \
-DBUILD_NEW_PYTHON_SUPPORT=ON \
-DWITH_V4L=ON \
-DOPENCV_EXTRA_MODULES_PATH=./modules
$ make -j2
$ sudo make install

In a nutshell, we download OpenCV 2.4 to the temporary folder, build it, make with two CPU cores, then install. It seems like those cmake parameters are actually pretty important to get stuff working!

-Sophie

Leave a Reply

Your email address will not be published. Required fields are marked *