步驟:
- cmake
1)下載cmake-3.8.2.tar.gz : https://cmake.org/files/
or https://blog.csdn.net/qq_42393859/article/details/85251356
2) 在主文件夾下新建tools/文件夾,將cmake-3.8.2.tar.gz解壓之後放在tools/中,爲了防止出現權限不足問題,直接對文件更改權限:
解壓:sudo tar -zxvf cmake-3.8.2.tar.gz
賦權限:sudo chmod -R 777 cmake-3.8.2
3)a安裝gcc-c++:
sudo apt-get install build-essential
或者直接執行這兩條命令
sudo apt-get install gcc
sudo apt-get install g++
4)進入文件夾下執行以下命令:
sudo ./bootstrap
sudo make
sudo make install
5)查看是否安裝成功以及安裝版本:
cmake --version
- 下載SDK源碼:
mkdir -p ~/tools/
cd ~/tools/
git clone https://github.com/IntelRealSense/librealsense.git
cd librealsense
- 安裝依賴:
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
- 先拔掉相機的USB線
- 執行權限設置,建立別名
./scripts/setup_udev_rules.sh
- 增加模塊
echo 'hid_sensor_custom' | sudo tee -a /etc/modules
- 添加變量到環境
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
- 編譯
- 增加cuda支持
mkdir build
cd build
cmake ../ -DBUILD_EXAMPLES=true -DBUILD_WITH_CUDA=true
sudo make uninstall && make clean && make && sudo make install
一直卡在了:
Building with TM2
https://github.com/IntelRealSense/librealsense/issues/3125
https://github.com/IntelRealSense/librealsense/issues/3182
https://github.com/IntelRealSense/librealsense/issues/2737
https://github.com/IntelRealSense/librealsense/issues/2719#issuecomment-474823042
打開cmakelist.txt
顯示
Internet connection identified
Info: REALSENSE_VERSION_STRING=2.29.0
Setting Unix configurations
using RS2_USE_V4L2_BACKEND
GLFW 3.3 not found; using internal version
Could NOT find Vulkan (missing: VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
Using X11 for window creation
Could NOT find apriltag (missing: APRILTAG_INC APRILTAG_LIB)
Unable to find apriltag library, skipping pose-apriltag example
Fetching recommended firmwares:
D4XX_RC_VERSION: 5.11.15.0
D4XX_FW_VERSION: 5.11.15.0
SR3XX_FW_VERSION: 3.26.1.0
Download firmware 0;"returning early; file already exists with expected SHA1 hash" for D4XX_FW_Image-5.11.15.0.bin
Download firmware 0;"returning early; file already exists with expected SHA1 hash" for D4XX_RC_Image-5.11.15.0.bin
Download firmware 0;"returning early; file already exists with expected SHA1 hash" for SR3XX_FW_Image-3.26.1.0.bin
Configuring done
Generating done
這裏會有一點慢
Download firmware 0;"returning early; file already exists with expected SHA1 hash" for D4XX_FW_Image-5.11.15.0.bin
Download firmware 0;"returning early; file already exists with expected SHA1 hash" for D4XX_RC_Image-5.11.15.0.bin
Download firmware 0;"returning early; file already exists with expected SHA1 hash" for SR3XX_FW_Image-3.26.1.0.bin
勾選Python選項
換成其他Python,帶有torch環境的,後續檢測+深度
https://blog.csdn.net/qq_22598167/article/details/89948089
https://www.cnblogs.com/z1141000271/p/10554341.html
勾選example
mkdir build && cd build
cmake ../ -DBUILD_EXAMPLES=true
sudo make uninstall && make clean && make -j8 && sudo make install
- 安裝完成後,相應目錄位於:
The shared object will be installed in /usr/local/lib
header files in /usr/local/include.
The binary demos, tutorials and test files will be copied into /usr/local/bin
測試:
- 測試例子:
cd ~/tools/librealsense/build/examples/capture
./rs-capture
- 效果如下:
參考:
- https://github.com/IntelRealSense/librealsense/blob/development/doc/installation.md
- https://github.com/jetsonhacks/buildLibrealsense2Xavier
- https://devtalk.nvidia.com/default/topic/1051016/jetson-nano/use-intel-reg-realsense-trade-d435-series-depth-camera-on-nano/post/5335681/#5335681
- https://www.ncnynl.com/archives/201905/3090.html
期間遇到的問題在此記錄一下:
1、
sudo apt install libssl-dev 時報錯,報錯信息如下
The following packages have unmet dependencies:
libssl-dev : Depends: libssl1.1 (= 1.1.0g-2ubuntu4) but 1.1.0g-2ubuntu4.3 is to be installed
Recommends: libssl-doc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
cmake ../ -DBUILD_EXAMPLES=true -DBUILD_WITH_CUDA=true 這一步時出現了下面的錯誤
-- GLFW 3.3 not found; using internal version
-- Could NOT find Vulkan (missing: VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
--
-- Configuring incomplete, errors occurred!
然後我又下載編譯GLFW也不行,編譯時也報錯中斷,網上搜索時,看到了這個提問,非常感謝
https://.com/questions/620601/-install-libsdl2-dev-or-cmake-glfw-libxinerama-dev-problem
在命令行執行sudo apt-get install libxinerama-dev
Using X11 for window creation CMake Error at third-party/glfw/CMakeLists.txt:235 (message):
The Xinerama headers were not found錯誤得以解決
再次配置編譯GLFW,參考此文章:https://blog.csdn.net/xyh930929/article/details/83745958
關於glfw,可觀看次文章:https://blog.csdn.net/zjz520yy/article/details/83000081
之前報的GLFW 3.3 not found; using internal version錯誤得以解決