纯净版Ubuntu18.04安装cuda10.2 OpenCV4.1.0 PCL1.8.0 QT5

注:以下操作都在重装后的ubuntu进行

一.cmake 自定义版本安装

!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
千万不要 apt-get autoremove cmake 否则重装系统吧

autoremove删除很多依赖,后续编译安装其他软件出现奇怪错误
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

1.下载

wget https://cmake.org/files/v3.9/cmake-3.9.1-Linux-x86_64.tar.gz
tar zxvf cmake-3.9.1-Linux-x86_64.tar.gz

2.创建软链接

mv cmake-3.9.1-Linux-x86_64 /opt/cmake-3.9.1
ln -sf /opt/cmake-3.9.1/bin/*  /usr/bin/ 

二nvidia驱动–cuda10.2

1.nvidia驱动

https://www.cnblogs.com/haijian/p/12810876.html

2.cuda10.2*.run安装

https://blog.csdn.net/weixin_43958086/article/details/108279996

3.测试:

nvidia-smi
nvcc -V

三.ubuntu 18.04 安装 opencv

1.依赖安装

https://blog.csdn.net/ColorKin/article/details/83781197?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.add_param_isCf&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.add_param_isCf

1.1其他依赖安装:

sudo apt-get install libgoogle-glog-dev ccache libgtk-3-dev libgoogle-glog-dev

【Opencv】【报错集锦】

error1:

– 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

error2:

Checking for modules ‘tesseract;lept’ No package ‘tesseract’ found Tesseract: NO

官网教程:https://www.linux.com/blog/using-tesseract-ubuntu

1) 安装依赖包

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

2)下载tessearct

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

2.cmake添加

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

3.编译

make -j$(nproc)

4.安装

sudo make install

四.PCL安装

sudo apt-get update  
sudo apt-get install git build-essential linux-libc-dev
sudo apt-get install libusb-1.0-0-dev libusb-dev libudev-dev
sudo apt-get install mpi-default-dev openmpi-bin openmpi-common 
sudo apt-get install libflann1.8 libflann-dev
sudo apt-get install libeigen3-dev 
sudo apt-get install libboost-all-dev
sudo apt-get install libvtk7.1-qt libvtk7.1 libvtk7-qt-dev
sudo apt-get install libqhull* libgtest-dev
sudo apt-get install freeglut3-dev pkg-config
sudo apt-get install libxmu-dev libxi-dev
sudo apt-get install mono-complete
sudo apt-get install openjdk-8-jdk openjdk-8-jre

error1:

  1. sudo apt-get install libflann1.8 libflann-dev,显示无法定位包libflann1.8,使用sudo apt-get update和sudo apt-get upgrade也没有解决问题。后来在Ubuntu packages上面看到ubuntu 18.04 bionic对应的版本是libflann1.9,改用libflann1.9执行成功。
sudo apt-get install libflann1.9 libflann-dev  sudo apt-get install libflann1.9 libflann-dev 
cd pcl 
mkdir release 
cd release
cmake -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_PREFIX=/usr \ -DBUILD_GPU=ON-DBUILD_apps=ON -DBUILD_examples=ON \ -DCMAKE_INSTALL_PREFIX=/usr .. 
make  -j$(nproc)

error2:

:-- Could NOT find OpenNI

– Could NOT find OpenNI2

Ubuntu 16.04 安装配置OpenNI2

参考:https://blog.csdn.net/qq_42668426/article/details/84991300

– Could NOT find FZAPI

– Could NOT find ensenso

– Could NOT find davidSDK

– Could NOT find DSSDK

– Could NOT find RSSDK

其实不影响安装

参考:https://blog.csdn.net/wangxiao7474/article/details/103823544

Checking for module ‘metslib’
– No package ‘metslib’ found
安装metslib
下载链接
https://www.coin-or.org/download/source/metslib/metslib-0.5.3.tgz
(文章后看能否上传资源)
解压后,在metslib-0.53打开命令终端:
执行:

 sudo sh ./configure
 sudo make
 sudo make install。

顺利完成安装metslib.

顺利完成安装metslib.

参考:https://blog.csdn.net/yunluoxiaobin/article/details/103078386

测试:
测试是否成功,打开窗口看到logo点云即为成功安装

pcl_viewer ../test/pcl_logo.pcd

参考
纯净版Ubuntu18.04安装cuda10.2 OpenCV4.1.0 PCL1.8.0 QT5_第1张图片

五.OpenCV和QT5

【QT+Opencv】【报错集锦】

error while loading shared libraries: libopencv_core.so.3.4: cannot open shared

https://blog.csdn.net/rong11417/article/details/103905794
https://blog.csdn.net/qq_36362060/article/details/78501231

cd ~                              //先返回到根目录
sudo vim /etc/ld.so.conf         //获取超级权限,并用vim编辑器打开该文件

末尾加入 /usr/local/lib即可

sudo ldconfig    //退出后执行下面的语句使之生效

你可能感兴趣的:(opencv安装,cuda,qt,自动驾驶,ubuntu,linux,opencv,cuda)