OpenCV 3 latest with Cuda and Python 2.7 and 3.4

Directions for installing Cuda 6.5 on AWS GPU Instance is here:

Install all the necessary packages to build opencv:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential git cmake cmake-curses-gui zlib1g-dev libeigen3-dev

sudo apt-get install checkinstall pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libncurses5-dev libv4l-dev python-dev python3-dev python-numpy python3-numpy python-pip python3-pip python-dbg python3-dbg python-matplotlib python3-matplotlib python-scipy python-scipy3 libtbb-dev libqt4-dev libgtk2.0-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils

may GRR not work - sudo apt-get install python3-numpy
sudo pip3 install numpy

Make the necessary source and build folders:
(I assume you are using bash here)
export todaysdate=`date "+%Y%m%d"`
mkdir opencvsrc$todaysdate
mkdir opencvbld$todaysdate

Download the opencv source:
cd opencvsrc$todaysdate
git clone
git clone

Upgrade Cmake (Ubuntu 14.04 default cmake is 2.8, need 3.2 or higher to detect Python 3.4)

tar zxvpf cmake-3.3.2.tar.gz
cd cmake-3.3.2/
make -j 12
sudo make install
export CMAKE_ROOT=/usr/local/share/cmake-3.3
cmake --version

Go into the build directory and use ccmake to configure your build.
cd ../opencvbld$todaysdate
ccmake ../opencvsrc$todaysdate/opencv

Hit ‘c’ to configure and then change these variables by moving to that line and hitting Enter.


Hit ‘c’ to configure
Hit ‘g’ to generate

Now build and install opencv.
make -j8
sudo make install

For getting test data and running tests on that data do this:
git clone git://
export OPENCV_TEST_DATA_PATH=/home/ubuntu/opencv_extra/testdata/

Lots of tests are in /usr/local/bin

If you just want to use my public AMI with the OpenCV source from March 25,2015 it is here (for US-East): ami-fa200b92

Leave a Reply

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