How to install openCv in Digital Ocean ubuntu One click AI droplet.

December 1, 2017 1.1k views
DigitalOcean One-Click Install Apps Python Frameworks Ubuntu 16.04
jhasuman
By:
jhasuman

How can I install opencv on digital ocean or is there any droplet available which comes with pre-installed opencv. ??

2 Answers

Digital Ocean doesn't come with a pre-installed "one click" solution for OpenCV.
You can do the install as follows on an Ubuntu 16.04 droplet

// Open CV 3

sudo apt-get -y install libtiff5-dev

sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
sudo apt-get -y install libxine2-dev libv4l-dev
sudo apt-get -y install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
sudo apt-get -y install qt5-default libgtk2.0-dev libtbb-dev
sudo apt-get -y install libatlas-base-dev
sudo apt-get -y install libfaac-dev libmp3lame-dev libtheora-dev
sudo apt-get -y install libvorbis-dev libxvidcore-dev
sudo apt-get -y install libopencore-amrnb-dev libopencore-amrwb-dev
sudo apt-get -y install x264 v4l-utils
sudo apt-get install -y gcc-5 g++-5

// Optional
sudo apt-get -y install libprotobuf-dev protobuf-compiler
sudo apt-get -y install libgoogle-glog-dev libgflags-dev
sudo apt-get -y install libgphoto2-dev libeigen3-dev libhdf5-dev doxygen

// download opencv-3.3.1
wget https://github.com/opencv/opencv/archive/3.3.1.zip -O opencv-3.3.1.zip
unzip opencv-3.3.1.zip

// download opencvcorntib-3.3.1
wget https://github.com/opencv/opencv
contrib/archive/3.3.1.zip -O opencvcontrib-3.3.1.zip
unzip opencv
contrib-3.3.1.zip

cd opencv-3.3.1
mkdir release
cd release

// compile and install
export CC=/usr/bin/gcc-5
export CXX=/usr/bin/g++-5
cmake -D CMAKEBUILDTYPE=RELEASE \
-D CMAKEINSTALLPREFIX=/usr/local \
-D INSTALLCEXAMPLES=ON \
-D INSTALLPYTHONEXAMPLES=ON \
-D WITHTBB=ON \
-D WITH
V4L=ON \
-D WITHQT=ON \
-D WITH
OPENGL=ON \
-D OPENCVEXTRAMODULESPATH=../../opencvcontrib-3.3.1/modules \
-D BUILD_EXAMPLES=ON ..

// Build with all cores
make "-j$(nproc)"

sudo make install
sudo sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig

Need to add:

sudo apt-get install unzip

before:

// download opencv-3.3.1
Have another answer? Share your knowledge.