依赖安装
参考:博客
sudo apt update
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libjasper
报错:无法定位到 libjasper软件包
sudo add-apt-repository “deb http://security.ubuntu.com/ubuntu xenial-security main”
sudo apt update
sudo apt install libjasper1 libjasper-dev
sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt install libgtk2.0-dev
sudo apt-get install libatlas-base-dev gfortran
sudo wget https://github.com/opencv/opencv/archive/3.4.3.zip
sudo unzip 3.4.3.zip
cd opencv-3.4.3
sudo mkdir my_demo
cd my_demo
cmake -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.2 `
-D WITH_PYTHON=OFF \
-D BUILD_TIFF=ON \
-D WITH_CUDA=ON \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=OFF \
-D CUDA_ARCH_BIN=7.5 \
-D OPENCV_CUDA_ARCH_PTX='' \
-D BUILD_EXAMPLES=OFF \
-D BUILD_JAVA=OFF \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_EXTRA_MODULES_PATH=/home/zzq/opencv-4.1.0/opencv_contrib-4.1.0/modules ../
make -j$(nproc)
https://blog.csdn.net/Phr_Nick/article/details/90725907
/home/zzq/opt/opencv_contrib/modules/xfeatures2d/src
https://www.pyimagesearch.com/2018/05/28/ubuntu-18-04-how-to-install-opencv/
https://github.com/opencv/opencv_contrib/archive/3.4.4.zip
https://github.com/ZZQ-sanmenxia/labelImg.git
– Checking for module ‘gstreamer-base-1.0’
– No package ‘gstreamer-base-1.0’ found
– Checking for module ‘gstreamer-video-1.0’
– No package ‘gstreamer-video-1.0’ found
– Checking for module ‘gstreamer-app-1.0’
– No package ‘gstreamer-app-1.0’ found
– Checking for module ‘gstreamer-riff-1.0’
– No package ‘gstreamer-riff-1.0’ found
– Checking for module ‘gstreamer-pbutils-1.0’
– No package ‘gstreamer-pbutils-1.0’ found
– Checking for module ‘gstreamer-base-0.10’
– No package ‘gstreamer-base-0.10’ found
– Checking for module ‘gstreamer-video-0.10’
– No package ‘gstreamer-video-0.10’ found
– Checking for module ‘gstreamer-app-0.10’
– No package ‘gstreamer-app-0.10’ found
– Checking for module ‘gstreamer-riff-0.10’
– No package ‘gstreamer-riff-0.10’ found
– Checking for module ‘gstreamer-pbutils-0.10’
– No package ‘gstreamer-pbutils-0.10’ found
#ref https://stackoverflow.com/questions/37678324/compiling-opencv-with-gstreamer-cmake-not-finding-gstreamer
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
https://www.jb51.net/article/149193.htm
– Checking for module 'libavresample’
– No package ‘libavresample’ found
********important
https://www.cnblogs.com/Jessey-Ge/p/10872331.html
module opencv-ovis disabled because OGRE3D was not found
sudo apt-get install libogre-1.9-dev #no solve
Checking for modules ‘tesseract;lept’ No package ‘tesseract’ found Tesseract: NO
https://www.linux.com/blog/using-tesseract-ubuntu
$ sudo apt-get install libpng-dev libjpeg-dev libtiff-dev zlib1g-dev
$ sudo apt-get install gcc g++
$ sudo apt-get install autoconf automake libtool checkinstall
$ cd ~
$ wget http://www.leptonica.org/source/leptonica-1.73.tar.gz
$ tar -zxvf leptonica-1.73.tar.gz
$ cd leptonica-1.73
$ ./configure
$ make
$ sudo checkinstall
$ sudo ldconfig
$ cd ~
$ git clone https://github.com/tesseract-ocr/tesseract.git
$ cd tesseract
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig
https://blog.csdn.net/cleanarea/article/details/85846257
https://www.linux.com/training-tutorials/using-tesseract-ubuntu/
#install tesseract latest
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev
解决方案:
1)wget http://ftp.ca.debian.org/debian/pool/main/g/gstreamer0.10/libgstreamer0.10-0_0.10.36-1.5_amd64.deb
2)wget http://ftp.ca.debian.org/debian/pool/main/g/gst-plugins-base0.10/libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb
3)sudo dpkg -i libgstreamer0.10-0_0.10.36-1.5_amd64.deb
4)sudo dpkg -i libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb
python3支持
sudo apt install python3-dev python3-numpy
streamer支持
sudo apt install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
可选的依赖
sudo apt install libpng-dev libopenexr-dev libtiff-dev libwebp-dev
error:
– Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version “3.7.0”)
cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_GENERATE_PKGCONFIG=YES -D CMAKE_INSTALL_PREFIX=/usr/local -D PYTHON_INCLUDE_DIR=/usr/include/python3.7 -D PYTHON_LIBRARY=/usr/lib/python3.7/config/libpython3.7.so ..
– Looking for ccache - not found
sudo apt-get install ccache
error:No package ‘libavresample’ found
sudo apt-get -y install libavresample-dev
error:No package ‘libgphoto2’ found
sudo apt-get -y install libgphoto2-dev
error:
– Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
– Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
– Could NOT find Atlas (missing: Atlas_CBLAS_INCLUDE_DIR Atlas_CLAPACK_INCLUDE_DIR Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY Atlas_LAPACK_LIBRARY)
git clone git://github.com/xianyi/OpenBLAS
cd OpenBLAS
sudo apt-get install gfortran
sudo make FC=gfortran
sudo make install
– Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
CSDN
fatal error: dynlink_nvcuvid.h: No such file or directory
https://www.cnblogs.com/penguins/p/10214817.html
cuda10 does not provide dynlink_nvcuvid.h any more.
解决方法:
查看出错在: opencv的modules目录下
modules/cudacodec/src/precomp.hpp
modules/cudacodec/src/frame_queue.hpp
modules/cudacodec/src/cuvid_video_source.hpp
modules/cudacodec/src/video_decoder.hpp
modules/cudacodec/src/video_parser.hpp
修改之后无需每次都要build只需要重新make即可
因为下载文件ippv挺慢的
#if CUDA_VERSION >= 9000
#include
#else
#include
#endif
所以可以用头文件nvcuvid.h
nvidia-sdk下载链接地址https://developer.nvidia.com/designworks/video_codec_sdk/downloads/v8.2-ga2
下载 nvidia-sdk 将其中的 nvcuvid.h, cuviddec.h copy 到 /usr/local/cuda/include/,同时将上面的代码改为:
#if CUDA_VERSION >= 9000 && CUDA_VERSION < 10000
#include
#else
#include
#endif
或者出现类似的错误 也是按照同样的方式进行更改
其实简单说就是放弃新的头文件dynlink_nvcuvid.h
使用原始的头文件 nvcuvid.h
原文链接:https://blog.csdn.net/zhe_csdn/article/details/100729031
Remove the following packages:
default-libmysqlclient-dev [1.0.4 (bionic, now)]
libgdal-dev [2.2.3+dfsg-2 (bionic, now)]
libmysqlclient-dev [5.7.30-0ubuntu0.18.04.1 (bionic-security, bionic-upda
libssl-dev [1.1.1-1ubuntu2.1~18.04.5 (bionic-security, bionic-updates, no
libvtk6-dev [6.3.0+dfsg1-11build1 (bionic, now)]
cuda install 2020-05-31
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pinsudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.debsudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.debsudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pubsudo apt-get updatesudo apt-get -y install cuda
cudnn install 2020-02-31
下载完解压文件,运行以下指令把解压后相应的文件拷贝到对应的CUDA目录下即可(要cd到含cudnn文件的目录下)
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
注:因为只是cudnn安装方式是将库文件放置再cuda目录下,所以版本万一不对也不要慌,可以重新删除再安装新的版本。
接下来编辑一个path环境变量文档:
sudo gedit ~/.bashrc
将cuda的环境变量加到打开的文件最后
export LD_LIBRARY_PATH=” L D L I B R A R Y P A T H : / u s r / l o c a l / c u d a / l i b 64 : / u s r / l o c a l / c u d a / e x t r a s / C U P T I / l i b 64 ” e x p o r t C U D A H O M E = / u s r / l o c a l / c u d a e x p o r t P A T H = " LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64” export CUDA_HOME=/usr/local/cuda export PATH=" LDLIBRARYPATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64”exportCUDAHOME=/usr/local/cudaexportPATH="CUDA_HOME/bin:$PATH"
文件生效:
source ~/.bashrc
原文链接:https://blog.csdn.net/weixin_40859436/article/details/83152249
no Found gtk±3.0, version 3.22.30
sudo apt-get install libgtk-3-dev
16
Failed to find glog - Could not find glog include directory, set
GLOG_INCLUDE_DIR to directory containing glog/logging.h
$ sudo apt-get install libgoogle-glog-dev
make error
Building CXX object modules/cudacodec/CMakeFiles/opencv_cudacodec.dir/src/video_reader.cpp.o
make[2]: *** No rule to make target /usr/lib/libnvcuvid.so', needed by
lib/libopencv_cudacodec.so.3.1.0’. Stop.
make[2]: *** Waiting for unfinished jobs…
locate libnvcuvid.so
sudo ln -s /path/to/##found##/libnvcuvid.so /usr/lib/libnvcuvid.so
https://www.cnblogs.com/yuanlibin/p/7735274.html
fatal error: dynlink_nvcuvid.h: No such file or directory
cuda10 does not provide dynlink_nvcuvid.h any more.
解决方法:
查看出错在: opencv的modules目录下
modules/cudacodec/src/precomp.hpp
modules/cudacodec/src/frame_queue.hpp
modules/cudacodec/src/cuvid_video_source.hpp
modules/cudacodec/src/video_decoder.hpp
modules/cudacodec/src/video_parser.hpp
#if CUDA_VERSION >= 9000
#include
#else
#include
#endif
同时将上面mevery hpp的代码改为:
#if CUDA_VERSION >= 9000 && CUDA_VERSION < 10000
#include
#else
#include
#endif
下载 nvidia-sdk 将其中的 nvcuvid.h, cuviddec.h copy 到 /usr/local/cuda/include/
放弃新的头文件dynlink_nvcuvid.h
使用原始的头文件 nvcuvid.h
原文链接:https://blog.csdn.net/zhe_csdn/article/details/100729031
3.fatal error: nvcuvid.h: No such file or directory
#include
才发现这个头文件在cuda10 以后就被弃了,在github上面找到解决方法,亲测可用。【https://github.com/opencv/opencv_contrib/pull/1946】
我们需要在英伟达官网把需要的组件下载下来(https://developer.nvidia.com/nvidia-video-codec-sdk#Download)
解压缩之后把 Video_Codec_SDK_9.0.20/include/ 下面的cuviddec.h 和 nvcuvid.h文件拷贝到/usr/include下面就好了
然后编译。我上传了这两个文件,可以直接下载
OpenCV编译遇到的一个常见错误-./bin: error while loading shared libraries: libopencv_highgui.so.3.2: cannot open
原文链接 https://blog.csdn.net/cv_you/article/details/77341631
链接: https://pan.baidu.com/s/1YXouWkRVi9z9s3sPx6BeyA 密码: rhgw