在jetson-Nano中安装OpenCV(c++)
情景引入
最近在
jetson AGX Xavier
跑代码的时候,因为需要CULane数据集的评价工具,发现里面没有,而编译的时候又需要C++
版本的OpenCV
,所以在这里记录一下安装编译的过程。
- NVIDIA jetson-系列的开发板架构都一样的,所以就没有改标题
————————————————————————————————————————————————-————————
1 相关链接
- https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
- https://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/
2 操作流程
2.1 Quick start
- Build core modules
# Install minimal prerequisites (Ubuntu 18.04 as reference)
sudo apt update && sudo apt install -y cmake g++ wget unzip
# Download and unpack sources
wget -O opencv.zip https://github.com/opencv/opencv/archive/master.zip
unzip opencv.zip
# Create build directory
mkdir -p build && cd build
# Configure
cmake ../opencv-master
# Build
cmake --build .
- Build with opencv_contrib
# Install minimal prerequisites (Ubuntu 18.04 as reference)
sudo apt update && sudo apt install -y cmake g++ wget unzip
# Download and unpack sources
wget -O opencv.zip https://github.com/opencv/opencv/archive/master.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/master.zip
unzip opencv.zip
unzip opencv_contrib.zip
# Create build directory and switch into it
mkdir -p build && cd build
# Configure
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=~/samsung-sd/downloads/opencv_contrib-master/modules \ # 此路径改成自己的
-D PYTHON_EXECUTABLE=~ /bin/python \
-D BUILD_EXAMPLES=ON ..
# Build
cmake --build .
结束