opencv4.6.0 + rtx2070 + ubuntu16.04 install tutorial
1. download the opencv 4.6.0 from: https://github.com/opencv/opencv/releases
2. unzip, mkdir build folder:
unzip opencv-4.6.0.zip mkdir build cd build
3. install the needed software packages:
sudo apt-get install build-essential sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
4. cmake, make, and install:
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. make -j24 sudo make install
5. 配置opencv的编译环境
# 首先将OpenCV的库添加到路径 sudo gedit /etc/ld.so.conf.d/opencv.conf # 打开一个空白的文件,需要在文件末尾添加 /usr/local/lib # 执行如下命令是的刚才的配置路径生效 sudo ldconfig # 配置bashrc sudo gedit /etc/bash.bashrc # 在打开的文件的末尾添加如下内容 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH # 保存之后,执行如下命令是的配置生效 source /etc/bash.bashrc # 更新 sudo updatedb
6. 测试opencv安装成功
进入 opencv-4.6.0/samples/cpp/example_cmake目录下,执行命令:
cmake .
make
./opencv_example
看到打开一个窗口,显示hello opencv表示安装成功。
也可以通过执行命令来查看是否安装成功: