The steps below describe how to compile, install and run python examples using CUDA on Nvidia platforms such as TX2 and AGX. (tested on Jetpack version 4.6.1)
- 1. Complete the FRAMOS software package installation, including CameraSuite and librealsense2. Refer to the ReadMe in installation files.
2. Copy librealsense2 folder to allocation with executable privilege, such as Desktop. The following guide will use ~/Desktop/librealsense2 as the source folder.
cp -r /usr/src/librealsense2 Desktop
4. Modify paths and apply to terminal.
echo "export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib" >> ~/.bashrc echo "export PATH=/usr/local/cuda-10.2/bin:$PATH" >> ~/.bashrc echo "export CUDACXX=/usr/local/cuda-10.2/bin/nvcc" >> ~/.bashrc echo "export PATH=/usr/src/framos/camerasuite/CMakePackages:$PATH" >> ~/.bashrc echo "export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1">> ~/.bashrc echo "export OPENLAS_CORETYPE=ARMV8" >> ~/.bashrc source ~/.bashrc
5. Go to source folder and create build folder.
cd ~/Desktop/librealsense2 mkdir build cd build
6. Configure Cmake to build with Python Bindings and CUDA. (Internet connection may be required)
cmake ../ -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=/usr/bin/python3 -DBUILD_WITH_CUDA=true -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true
7. Make and install. (Note that compilation could take some time depending on the processors available, wait and install once it's at 100%)
make -j4 sudo make install
8. Copy pyrealsense2 library to a folder where the python code is executed. In this guide, pyrealsense2 is built from source in Step 7, and to include the library we just copy it to the same folder as the source code. (Note this step is required as the pyrealsense2 library has been modified to recognize the Framos Intel cameras)
cp ~/Desktop/librealsense2/build/wrapper/python/pyrealsense2* ~/Desktop/librealsense2/wrapper/python/examples/
9. Run align-depth2color example. Beside command line output, the video stream should be displayed in a seperate window.