JETSON TK1 ~ 安装Cuda和OpenCV3
一:安装Cuda6.5
1:下载安装包
2、在TK1上安装软件包:
cd ~/Downloads sudo dpkg -i cuda-repo-l4t-r21.3-6-5-prod_6.5-42_armhf.deb sudo apt-get update sudo apt-get install cuda-toolkit-6-5 sudo usermod -a -G video $USER
3、配置到.bashrc
echo "# Add CUDA bin & library paths:" >> ~/.bashrc echo "export PATH=/usr/local/cuda/bin:$PATH" >> ~/.bashrc echo "export LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
4、验证版本
nvcc -V
二:安装OpenCV3.4.1
1、下载安装包
2、安装依赖项
sudo apt-get install build-essential libgtk2.0-dev libvtk5-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev libtbb-dev sudo apt-get install build-essential make cmake cmake-curses-gui \g++ libavformat-dev libavutil-dev \ libswscale-dev libv4l-dev libeigen3-dev \ libglew-dev libgtk2.0-dev sudo apt-get install libdc1394-22-dev libxine2-dev \ libgstreamer1.0-dev \ libgstreamer-plugins-base1.0-dev sudo apt-get install libjpeg8-dev libjpeg-turbo8-dev libtiff5-dev \ libjasper-dev libpng12-dev libavcodec-dev sudo apt-get install libxvidcore-dev libx264-dev libgtk-3-dev \ libatlas-base-dev gfortran sudo apt-get install libopenblas-dev liblapack-dev liblapacke-dev
3、修改cuda_gl_interop.h文件
sudo vim /usr/local/cuda/include/cuda_gl_interop.h
4、解压下载的源码并创建编译目录
unzip opencv-3.4.1.zip cd opencv-3.4.1/ mkdir build cd build
5、生成makefile温江并编译安装
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local \ -D WITH_CUDA=ON -D CUDA_ARCH_BIN="3.2" -D CUDA_ARCH_PTX="" \ -D WITH_CUBLAS=ON -D ENABLE_FAST_MATH=ON -D CUDA_FAST_MATH=ON \ -D ENABLE_NEON=ON -D WITH_LIBV4L=ON -D BUILD_TESTS=OFF \ -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF \ -D WITH_QT=ON -D WITH_OPENGL=OFF .. make -j4 sudo make install