安装opencv
参考: https://milq.github.io/install-opencv-ubuntu-debian/
###################################### # INSTALL OPENCV ON UBUNTU OR DEBIAN # ###################################### # | THIS SCRIPT IS TESTED CORRECTLY ON | # |------------------------------------------------------| # | OS | OpenCV | Test | Last test | # |------------------|--------------|------|-------------| # | Ubuntu 18.04 LTS | OpenCV 3.4.2 | OK | 18 Jul 2018 | # | Debian 9.5 | OpenCV 3.4.2 | OK | 18 Jul 2018 | # |----------------------------------------------------- | # | Debian 9.0 | OpenCV 3.2.0 | OK | 25 Jun 2017 | # | Debian 8.8 | OpenCV 3.2.0 | OK | 20 May 2017 | # | Ubuntu 16.04 LTS | OpenCV 3.2.0 | OK | 20 May 2017 | # VERSION TO BE INSTALLED OPENCV_VERSION='3.4.2' # 1. KEEP UBUNTU OR DEBIAN UP TO DATE sudo apt-get -y update sudo apt-get -y upgrade sudo apt-get -y dist-upgrade sudo apt-get -y autoremove # 2. INSTALL THE DEPENDENCIES # Build tools: sudo apt-get install -y build-essential cmake # GUI (if you want to use GTK instead of Qt, replace 'qt5-default' with 'libgtkglext1-dev' and remove '-DWITH_QT=ON' option in CMake): sudo apt-get install -y qt5-default libvtk6-dev # Media I/O: sudo apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libjasper-dev libopenexr-dev libgdal-dev # Video I/O: sudo apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev # Parallelism and linear algebra libraries: sudo apt-get install -y libtbb-dev libeigen3-dev # Python: sudo apt-get install -y python-dev python-tk python-numpy python3-dev python3-tk python3-numpy # Java: sudo apt-get install -y ant default-jdk # Documentation: sudo apt-get install -y doxygen # 3. INSTALL THE LIBRARY sudo apt-get install -y unzip wget wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip unzip ${OPENCV_VERSION}.zip rm ${OPENCV_VERSION}.zip mv opencv-${OPENCV_VERSION} OpenCV cd OpenCV mkdir build cd build cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=ON -DENABLE_PRECOMPILED_HEADERS=OFF .. make -j4 sudo make install sudo ldconfig # 4. EXECUTE SOME OPENCV EXAMPLES AND COMPILE A DEMONSTRATION # To complete this step, please visit 'http://milq.github.io/install-opencv-ubuntu-debian'.
sudo ldconfig
提示
/sbin/ldconfig.real: /usr/local/cuda/lib64/libcudnn.so.5 is not a symbolic link
cd /usr/local/cuda/lib64/ ls -lha libcudnn* sudo rm libcudnn.so sudo rm libcudnn.so.5 sudo ln libcudnn.so.5.1.10 libcudnn.so.5 sudo ln libcudnn.so.5 libcudnn.so cd ~/OpenCV/build/ sudo ldconfig
C++测试
cd ~/Opencv/build/bin ./example_cpp_edge ../../samples/data/fruits.jpg
Java测试:
cd ~/Opencv/samples/java/ant ant -DocvJarDir=../../../build/bin -DocvLibDir=../../../build/lib
编译demo
Download the files demo.cpp and CMakeLists.txt and put them into folder ~/Opencv/samples/demo .
cd ~/Opencv/samples/demo mkdir build && cd build && cmake .. && make ./demo
python测试:
cd ~/Opencv/samples/python python3 video.py
居然
ModuleNotFoundError: No module named 'cv2'
装下面这个好了
pip install opencv-python
本文由safa 创作,采用 知识共享署名-相同方式共享 3.0 中国大陆许可协议 进行许可。
转载、引用前需联系作者,并署名作者且注明文章出处。
本站文章版权归原作者及原出处所有 。内容为作者个人观点, 并不代表本站赞同其观点和对其真实性负责。本站是一个个人学习交流的平台,并不用于任何商业目的,如果有任何问题,请及时联系我们,我们将根据著作权人的要求,立即更正或者删除有关内容。本站拥有对此声明的最终解释权。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- Golang入门:从安装、部署以及GoLand的安装开始
- Win2016上安装SFB2015先决条件安装失败:RewriteModule
- mac:Go安装和配置+GoLand安装和使用之完整教程
- Pulsar本地单机(伪)集群 (裸机安装与docker方式安装) 2.2.0
- 如何将Rancher 2.1.x 从单节点安装迁移到高可用安装
- (教科书式教程!)在VMware Workstation 14 上安装CentOS 7 【送安装包】
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Computers and Intractability
M R Garey、D S Johnson / W. H. Freeman / 1979-4-26 / GBP 53.99
This book's introduction features a humorous story of a man with a line of people behind him, who explains to his boss, "I can't find an efficient algorithm, but neither can all these famous people." ......一起来看看 《Computers and Intractability》 这本书的介绍吧!