Last active
March 19, 2019 13:31
-
-
Save austince/f609fa2dc2821e52e4ce781a9205d4fe to your computer and use it in GitHub Desktop.
OpenCV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Open CV 3.3.1 on Ubuntu 16.04 | |
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 opencv_corntib-3.3.1 | |
wget https://github.com/opencv/opencv_contrib/archive/3.3.1.zip -O opencv_contrib-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 CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/usr/local \ | |
-D INSTALL_C_EXAMPLES=ON \ | |
-D INSTALL_PYTHON_EXAMPLES=ON \ | |
-D WITH_TBB=ON \ | |
-D WITH_V4L=ON \ | |
-D WITH_QT=ON \ | |
-D WITH_OPENGL=ON \ | |
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.3.1/modules \ | |
-D BUILD_EXAMPLES=ON .. | |
# Build with half of your cores, still can use computer | |
make "-j$(expr `nproc` / 2 )" | |
# Build with all cores, probablity can't use your computer... | |
# make "-j$(nproc)" | |
sudo make install | |
sudo sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf' | |
sudo ldconfig | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome! I think I have it installed properly but when I test a demo I keep getting (putty)
QXcbConnection: Could not connect to display
Aborted (core dumped)
I can see the results from my "rotate" demo in text:
[[ 0.8660254 -0.5 162.29749663]
[ 0.5 0.8660254 -93.70250337]]
but it gets dumped after. I'm thinking if its because I am using putty to access my virtual server on Digital Ocean and that putty is text based and can't display graphics. I don't want to mess with the install because if might be fine as is, so I'm trying to find a solution that allows for testing with a graphical result (as it should be).
Any ideas?