git clone https://github.com/OpenKinect/libfreenect2.git
sudo apt-get install build-essential cmake pkg-config libturbojpeg libjpeg-turbo8-dev mesa-common-dev freeglut3-dev libxrandr-dev libxi-dev
sudo apt-get install libglfw3-dev
sudo apt-get install libopenni2-dev
sudo apt-get install libusb-1.0-0-dev(sudo apt-get install libusb-1.0-0-dev libusb-dev libudev-dev)
cd libfreenect2
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2
make
make install
sudo cp libfreenect2/platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/
./bin/Protonect
sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-devsudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-devsudo apt-get install -y python2.7-devsudo apt-get install -y python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-devsudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucpsudo apt-get install -y curlsudo apt-get update
mkdir -p ~/tools/cd ~/tools/curl -L https://github.com/opencv/opencv/archive/3.2.0.zip -o opencv-3.2.0.zipunzip opencv-3.2.0.zip cd opencv-3.2.0/
git clone https://github.com/opencv/opencv_contrib.gitcd opencv_contribgit checkout -b v3.2.0 3.2.0
/home/nvidia/data/tools/opencv-3.2.0/cmake/找到FindCUDA.cmake文件
git clone https://github.com/opencv/opencv_contrib.gitcd opencv_contribgit checkout -b v3.2.0 3.2.0
find_cuda_helper_libs(nppi)
替换为:
find_cuda_helper_libs(nppial)
find_cuda_helper_libs(nppicc)
find_cuda_helper_libs(nppicom)
find_cuda_helper_libs(nppidei)
find_cuda_helper_libs(nppif)
find_cuda_helper_libs(nppig)
find_cuda_helper_libs(nppim)
find_cuda_helper_libs(nppist)
find_cuda_helper_libs(nppisu)
find_cuda_helper_libs(nppitc)
set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppi_LIBRARY};${CUDA_npps_LIBRARY}")
替换为:
set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")
unset(CUDA_nppi_LIBRARY CACHE)
替换为:
unset(CUDA_nppial_LIBRARY CACHE)
unset(CUDA_nppicc_LIBRARY CACHE)
unset(CUDA_nppicom_LIBRARY CACHE)
unset(CUDA_nppidei_LIBRARY CACHE)
unset(CUDA_nppif_LIBRARY CACHE)
unset(CUDA_nppig_LIBRARY CACHE)
unset(CUDA_nppim_LIBRARY CACHE)
unset(CUDA_nppist_LIBRARY CACHE)
unset(CUDA_nppisu_LIBRARY CACHE)
unset(CUDA_nppitc_LIBRARY CACHE)
同时,找到OpenCVDetectCUDA.cmake文件:
...
set(__cuda_arch_ptx "")
if(CUDA_GENERATION STREQUAL "Fermi")
set(__cuda_arch_bin "2.0")
elseif(CUDA_GENERATION STREQUAL "Kepler")
set(__cuda_arch_bin "3.0 3.5 3.7")
改为
... set(__cuda_arch_ptx "") if(CUDA_GENERATION STREQUAL "Kepler") set(__cuda_arch_bin "3.0 3.5 3.7") elseif(CUDA_GENERATION STREQUAL "Maxwell") set(__cuda_arch_bin "5.0 5.2")
将头文件cuda_fp16.h添加至 opencv\modules\cudev\include\opencv2\cudev\common.hpp
#include
mkdir releasecd release/cmake -D WITH_CUDA=ON -D CUDA_ARCH_BIN="7.2" -D ENABLE_PRECOMPILED_HEADERS=OFF -D CUDA_ARCH_PTX="" -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=~/tools/opencv_contrib/modules ..
makesudo make install
cd /lib/aarch64-linux-gnu
sudo ln -s /usr/local/lib/libopencv_aruco.so.3.2.0 libopencv_aruco.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_cudaimgproc.so.3.2.0 libopencv_cudaimgproc.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_flann.so.3.2.0 libopencv_flann.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_phase_unwrapping.so.3.2.0 libopencv_phase_unwrapping.so.3.2.0sudo ln -s /usr/local/lib/libopencv_surface_matching.so.3.2.0 libopencv_surface_matching.so.3.2.0sudo ln -s /usr/local/lib/libopencv_bgsegm.so.3.2.0 libopencv_bgsegm.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_cudalegacy.so.3.2.0 libopencv_cudalegacy.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_freetype.so.3.2.0 libopencv_freetype.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_photo.so.3.2.0 libopencv_photo.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_text.so.3.2.0 libopencv_text.so.3.2.0sudo ln -s /usr/local/lib/libopencv_bioinspired.so.3.2.0 libopencv_bioinspired.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_cudaobjdetect.so.3.2.0 libopencv_cudaobjdetect.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_fuzzy.so.3.2.0 libopencv_fuzzy.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_plot.so.3.2.0 libopencv_plot.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_videoio.so.3.2.0 libopencv_videoio.so.3.2.0sudo ln -s /usr/local/lib/libopencv_calib3d.so.3.2.0 libopencv_calib3d.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_cudaoptflow.so.3.2.0 libopencv_cudaoptflow.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_hdf.so.3.2.0 libopencv_hdf.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_reg.so.3.2.0 libopencv_reg.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_video.so.3.2.0 libopencv_video.so.3.2.0sudo ln -s /usr/local/lib/libopencv_ccalib.so.3.2.0 libopencv_ccalib.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_cudastereo.so.3.2.0 libopencv_cudastereo.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_highgui.so.3.2.0 libopencv_highgui.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_rgbd.so.3.2.0 libopencv_rgbd.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_videostab.so.3.2.0 libopencv_videostab.so.3.2.0sudo ln -s /usr/local/lib/libopencv_core.so.3.2.0 libopencv_core.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_cudawarping.so.3.2.0 libopencv_cudawarping.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_imgcodecs.so.3.2.0 libopencv_imgcodecs.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_saliency.so.3.2.0 libopencv_saliency.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_viz.so.3.2.0 libopencv_viz.so.3.2.0sudo ln -s /usr/local/lib/libopencv_cudaarithm.so.3.2.0 libopencv_cudaarithm.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_cudev.so.3.2.0 libopencv_cudev.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_imgproc.so.3.2.0 libopencv_imgproc.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_shape.so.3.2.0 libopencv_shape.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_xfeatures2d.so.3.2.0 libopencv_xfeatures2d.so.3.2.0sudo ln -s /usr/local/lib/libopencv_cudabgsegm.so.3.2.0 libopencv_cudabgsegm.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_datasets.so.3.2.0 libopencv_datasets.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_line_descriptor.so.3.2.0 libopencv_line_descriptor.so.3.2.0sudo ln -s /usr/local/lib/libopencv_stereo.so.3.2.0 libopencv_stereo.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_ximgproc.so.3.2.0 libopencv_ximgproc.so.3.2.0sudo ln -s /usr/local/lib/libopencv_cudacodec.so.3.2.0 libopencv_cudacodec.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_dpm.so.3.2.0 libopencv_dpm.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_ml.so.3.2.0 libopencv_ml.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_stitching.so.3.2.0 libopencv_stitching.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_xobjdetect.so.3.2.0 libopencv_xobjdetect.so.3.2.0sudo ln -s /usr/local/lib/libopencv_cudafeatures2d.so.3.2.0 libopencv_cudafeatures2d.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_face.so.3.2.0 libopencv_face.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_objdetect.so.3.2.0 libopencv_objdetect.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_structured_light.so.3.2.0 libopencv_structured_light.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_xphoto.so.3.2.0 libopencv_xphoto.so.3.2.0sudo ln -s /usr/local/lib/libopencv_cudafilters.so.3.2.0 libopencv_cudafilters.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_features2d.so.3.2.0 libopencv_features2d.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_optflow.so.3.2.0 libopencv_optflow.so.3.2.0 sudo ln -s /usr/local/lib/libopencv_superres.so.3.2.0 libopencv_superres.so.3.2.0
cd ~/catkin_ws/src/
git clone https://github.com/code-iai/iai_kinect2.git cd iai_kinect2
rosdep install --from-paths ~/data/catkin_ws/src/iai_kinect2 --ignore-src -r
cd ~/catkin_ws
catkin_make -DCMAKE_BUILD_TYPE="Release"