Build and Install latest OpenCV with CUDA 6.5 on an AWS GPU instance with Ubuntu 14.04

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 libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils

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

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.
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 *