在Jetson Nano上编译 pyrealsense2库包,并在Intel的tof相机上进行测试
关于如何从源码编译pyrealsense2
文章目录:
- 1 编译librealsense中python相关的库
- 2 使用pyrealsense2获取Intel 的tof相机视频流用例
1 编译librealsense中python相关的库
1、创建build目录
mkdir build
注意:
build目录是在librealsense
目录下创建的
2、进入build目录
cd build
3、cmake
cmake ../ -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=/usr/bin/python3
zhihui@zhihui-desktop:~/librealsense/build$ cmake ../ -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=/usr/bin/python3
-- Checking internet connection...
-- Failed to identify Internet connection
CMake Warning at CMakeLists.txt:16 (message):No internet connection, disabling BUILD_WITH_TM2CMake Warning at CMakeLists.txt:22 (message):No internet connection, disabling IMPORT_DEPTH_CAM_FW-- Info: REALSENSE_VERSION_STRING=2.41.0
-- Setting Unix configurations
-- using RS2_USE_V4L2_BACKEND
-- pybind11 v2.2.1
-- Could NOT find apriltag (missing: APRILTAG_INC APRILTAG_LIB)
-- Unable to find apriltag library, skipping pose-apriltag example
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zhihui/librealsense/build
zhihui@zhihui-desktop:~/librealsense/build$
注意:
- 在cmake的时候最好
把网断掉
,要不在编译的时候可能会检测网络是否连接,会很慢 - 如果不指定,默认是生成python2的动态库,这里我们指定为
python3
:-DPYTHON_EXECUTABLE=/usr/bin/python3
纠正一下:
一定要联网,一定要联网,一定要联网
,在cmke的时候,会去克隆github上的pybind11
仓库,大小大概9MB,因此必须联网,耐心等待一下即可!
4、make编译
make -j3
这个编译会久一点,大概半个小时左右,耐心等一下!
zhihui@zhihui-desktop:~/librealsense/build$ make -j3
Scanning dependencies of target pybac等一下kend2
Scanning dependencies of target realsense-file
[ 0%] Building CXX object wrappers/python/CMakeFiles/pybackend2.dir/pybackend.cpp.o
[ 0%] Building CXX object wrappers/python/CMakeFiles/pybackend2.dir/pybackend_extras.cpp.o
[ 0%] Building C object third-party/realsense-file/CMakeFiles/realsense-file.dir/lz4/lz4.c.o
[ 0%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/console_bridge/src/console.cpp.o
[ 0%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/cpp_common/src/debug.cpp.o
[ 1%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/cpp_common/src/header.cpp.o
[ 1%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/rosbag_storage/src/bag.cpp.o
[ 1%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/rosbag_storage/src/bag_player.cpp.o
In file included from /home/zhihui/librealsense/third-party/realsense-file/rosbag/rosbag_storage/src/bag_player.cpp:1:0:
/home/zhihui/librealsense/third-party/realsense-file/rosbag/rosbag_storage/include/rosbag/bag_player.h:81:42: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]BagPlayer(const std::string &filename) throw(BagException);^~~~~
/home/zhihui/librealsense/third-party/realsense-file/rosbag/rosbag_storage/src/bag_player.cpp:8:48: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]BagPlayer::BagPlayer(const std::string &fname) throw(BagException) {^~~~~
In file included from /home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/detail/maybe_include.hpp:18:0,from /home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/detail/function_iterate.hpp:14,from /home/zhihui/librealsense/third-party/realsense-file/boost/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,from /home/zhihui/librealsense/third-party/realsense-file/boost/boost/function.hpp:64,from /home/zhihui/librealsense/third-party/realsense-file/rosbag/roscpp_traits/include/ros/message_event.h:42,from /home/zhihui/librealsense/third-party/realsense-file/rosbag/rosbag_storage/include/rosbag/bag.h:50,from /home/zhihui/librealsense/third-party/realsense-file/rosbag/rosbag_storage/include/rosbag/bag_player.h:40,from /home/zhihui/librealsense/third-party/realsense-file/rosbag/rosbag_storage/src/bag_player.cpp:1:
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_template.hpp: In instantiation of ‘void boost::detail::function::basic_vtable1<R, T0>::assign_functor(FunctionObj, boost::detail::function::function_buffer&, mpl_::true_) const [with FunctionObj = rosbag::TopicQuery; R = bool; T0 = const rosbag::ConnectionInfo*; mpl_::true_ = mpl_::bool_<true>]’:
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_template.hpp:608:27: required from ‘bool boost::detail::function::basic_vtable1<R, T0>::assign_to(FunctionObj, boost::detail::function::function_buffer&, boost::detail::function::function_obj_tag) const [with FunctionObj = rosbag::TopicQuery; R = bool; T0 = const rosbag::ConnectionInfo*]’
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_template.hpp:498:27: required from ‘bool boost::detail::function::basic_vtable1<R, T0>::assign_to(F, boost::detail::function::function_buffer&) const [with F = rosbag::TopicQuery; R = bool; T0 = const rosbag::ConnectionInfo*]’
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_template.hpp:942:7: required from ‘void boost::function1<R, T1>::assign_to(Functor) [with Functor = rosbag::TopicQuery; R = bool; T0 = const rosbag::ConnectionInfo*]’
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_template.hpp:728:7: required from ‘boost::function1<R, T1>::function1(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = rosbag::TopicQuery; R = bool; T0 = const rosbag::ConnectionInfo*; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]’
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_template.hpp:1077:16: required from ‘boost::function<R(T0)>::function(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = rosbag::TopicQuery; R = bool; T0 = const rosbag::ConnectionInfo*; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]’
/home/zhihui/librealsense/third-party/realsense-file/rosbag/rosbag_storage/src/bag_player.cpp:50:60: required from here
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_template.hpp:572:11: warning: placement new constructing an object of type ‘rosbag::TopicQuery’ and size ‘24’ in a region of type ‘char’ and size ‘1’ [-Wplacement-new=]new (reinterpret_cast<void*>(&functor.data)) FunctionObj(f);^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/detail/prologue.hpp:17:0,from /home/zhihui/librealsense/third-party/realsense-file/boost/boost/function.hpp:24,from /home/zhihui/librealsense/third-party/realsense-file/rosbag/roscpp_traits/include/ros/message_event.h:42,from /home/zhihui/librealsense/third-party/realsense-file/rosbag/rosbag_storage/include/rosbag/bag.h:50,from /home/zhihui/librealsense/third-party/realsense-file/rosbag/rosbag_storage/include/rosbag/bag_player.h:40,from /home/zhihui/librealsense/third-party/realsense-file/rosbag/rosbag_storage/src/bag_player.cpp:1:
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_base.hpp: In instantiation of ‘static void boost::detail::function::functor_manager_common<Functor>::manage_small(const boost::detail::function::function_buffer&, boost::detail::function::function_buffer&, boost::detail::function::functor_manager_operation_type) [with Functor = rosbag::TopicQuery]’:
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_base.hpp:364:56: required from ‘static void boost::detail::function::functor_manager<Functor>::manager(const boost::detail::function::function_buffer&, boost::detail::function::function_buffer&, boost::detail::function::functor_manager_operation_type, mpl_::true_) [with Functor = rosbag::TopicQuery; mpl_::true_ = mpl_::bool_<true>]’
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_base.hpp:412:18: required from ‘static void boost::detail::function::functor_manager<Functor>::manager(const boost::detail::function::function_buffer&, boost::detail::function::function_buffer&, boost::detail::function::functor_manager_operation_type, boost::detail::function::function_obj_tag) [with Functor = rosbag::TopicQuery]’
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_base.hpp:440:20: required from ‘static void boost::detail::function::functor_manager<Functor>::manage(const boost::detail::function::function_buffer&, boost::detail::function::function_buffer&, boost::detail::function::functor_manager_operation_type) [with Functor = rosbag::TopicQuery]’
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_template.hpp:940:13: required from ‘void boost::function1<R, T1>::assign_to(Functor) [with Functor = rosbag::TopicQuery; R = bool; T0 = const rosbag::ConnectionInfo*]’
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_template.hpp:728:7: required from ‘boost::function1<R, T1>::function1(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = rosbag::TopicQuery; R = bool; T0 = const rosbag::ConnectionInfo*; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]’
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_template.hpp:1077:16: required from ‘boost::function<R(T0)>::function(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = rosbag::TopicQuery; R = bool; T0 = const rosbag::ConnectionInfo*; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]’
/home/zhihui/librealsense/third-party/realsense-file/rosbag/rosbag_storage/src/bag_player.cpp:50:60: required from here
/home/zhihui/librealsense/third-party/realsense-file/boost/boost/function/function_base.hpp:318:13: warning: placement new constructing an object of type ‘boost::detail::function::functor_manager_common<rosbag::TopicQuery>::functor_type {aka rosbag::TopicQuery}’ and size ‘24’ in a region of type ‘char’ and size ‘1’ [-Wplacement-new=]new (reinterpret_cast<void*>(&out_buffer.data)) functor_type(*in_functor);^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 1%] Building CXX object wrappers/python/CMakeFiles/pybackend2.dir/__/__/src/types.cpp.o
[ 2%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/rosbag_storage/src/buffer.cpp.o
[ 2%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/rosbag_storage/src/chunked_file.cpp.o
[ 2%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/rosbag_storage/src/lz4_stream.cpp.o
[ 2%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/rosbag_storage/src/message_instance.cpp.o
[ 3%] Building CXX object wrappers/python/CMakeFiles/pybackend2.dir/__/__/src/log.cpp.o
[ 4%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/rosbag_storage/src/query.cpp.o
[ 4%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/rosbag_storage/src/stream.cpp.o
[ 4%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/rosbag_storage/src/uncompressed_stream.cpp.o
[ 5%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/rosbag_storage/src/view.cpp.o
[ 5%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/roscpp_serialization/src/serialization.cpp.o
[ 5%] Building CXX object wrappers/python/CMakeFiles/pybackend2.dir/__/__/src/backend.cpp.o
[ 5%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/rostime/src/duration.cpp.o
[ 5%] Building CXX object wrappers/python/CMakeFiles/pybackend2.dir/__/__/src/libusb/interface-libusb.cpp.o
[ 5%] Building CXX object third-party/realsense-file/CMakeFiles/realsense-file.dir/rosbag/rostime/src/rate.cpp.o
In file included from /home/zhihui/librealsense/src/libusb/endpoint-libusb.h:8:0,from /home/zhihui/librealsense/src/libusb/interface-libusb.h:6,from /home/zhihui/librealsense/src/libusb/interface-libusb.cpp:4:
/usr/include/libusb-1.0/libusb.h:736:4: warning: ISO C++ forbids zero-size array ‘dev_capability_data’ [-Wpedantic][0] /* non-standard, but usually working code */^
/usr/include/libusb-1.0/libusb.h:767:4: warning: ISO C++ forbids zero-size array ‘dev_capability’ [-Wpedantic][0] /* non-standard, but usually working code */^
/usr/include/libusb-1.0/libusb.h:1263:4: warning: ISO C++ forbids zero-size array ‘iso_packet_desc’ [-Wpedantic][0] /* non-standard, but usually working code */^
......
[ 94%] Building CXX object tools/realsense-viewer/CMakeFiles/realsense-viewer.dir/realsense-viewer.cpp.o
[ 94%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/updates-model.cpp.o
/home/zhihui/librealsense/common/on-chip-calib.cpp: In member function ‘int rs2::tare_ground_truth_calculator::smooth_corner_locations(float&)’:
/home/zhihui/librealsense/common/on-chip-calib.cpp:2129:26: warning: operation on ‘((rs2::tare_ground_truth_calculator*)this)->rs2::tare_ground_truth_calculator::_corners_idx’ may be undefined [-Wsequence-point]_corners_idx = ++_corners_idx % _frame_num;~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 94%] Building CXX object tools/realsense-viewer/CMakeFiles/realsense-viewer.dir/__/__/third-party/imgui/imgui.cpp.o
[ 94%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/cah-model.cpp.o
[ 95%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/sw-update/http-downloader.cpp.o
[ 96%] Building CXX object tools/realsense-viewer/CMakeFiles/realsense-viewer.dir/__/__/third-party/imgui/imgui_draw.cpp.o
[ 96%] Building CXX object tools/realsense-viewer/CMakeFiles/realsense-viewer.dir/__/__/third-party/imgui/imgui_impl_glfw.cpp.o
[ 96%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/sw-update/dev-updates-profile.cpp.o
[ 96%] Building C object tools/realsense-viewer/CMakeFiles/realsense-viewer.dir/__/__/third-party/glad/glad.c.o
[ 96%] Building C object tools/realsense-viewer/CMakeFiles/realsense-viewer.dir/__/__/third-party/tinyfiledialogs/tinyfiledialogs.c.o
[ 97%] Building CXX object tools/realsense-viewer/CMakeFiles/realsense-viewer.dir/__/__/third-party/easyloggingpp/src/easylogging++.cc.o
[ 97%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/sw-update/versions-db-manager.cpp.o
[ 97%] Linking CXX executable realsense-viewer
[ 98%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/reflectivity/reflectivity.cpp.o
[ 98%] Built target realsense-viewer
[ 98%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/rs-depth-quality.cpp.o
[ 98%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/depth-quality-model.cpp.o
[ 98%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/imgui/imgui.cpp.o
[ 99%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/imgui/imgui_draw.cpp.o
[ 99%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/imgui/imgui_impl_glfw.cpp.o
[ 99%] Building C object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/glad/glad.c.o
[100%] Building C object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/tinyfiledialogs/tinyfiledialogs.c.o
[100%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/easyloggingpp/src/easylogging++.cc.o
[100%] Linking CXX executable rs-depth-quality
[100%] Built target rs-depth-quality
zhihui@zhihui-desktop:~/librealsense/build$
5、开始安装
sudo make install
zhihui@zhihui-desktop:~/librealsense/build$ sudo make install
[sudo] password for zhihui:
[ 6%] Built target realsense-file
[ 43%] Built target realsense2
[ 47%] Built target pybackend2
[ 52%] Built target pyrealsense2
[ 56%] Built target realsense2-gl
[ 56%] Built target rs-hello-realsense
[ 56%] Built target rs-software-device
[ 56%] Built target rs-capture
[ 57%] Built target rs-callback
[ 58%] Built target rs-save-to-disk
[ 58%] Built target rs-multicam
[ 59%] Built target rs-pointcloud
[ 60%] Built target rs-align
[ 62%] Built target rs-align-advanced
[ 63%] Built target rs-sensor-control
[ 64%] Built target rs-measure
[ 64%] Built target rs-depth
[ 65%] Built target rs-color
[ 66%] Built target rs-distance
[ 67%] Built target rs-post-processing
[ 68%] Built target rs-record-playback
[ 69%] Built target rs-motion
[ 69%] Built target rs-gl
[ 69%] Built target rs-pose
[ 70%] Built target rs-pose-predict
[ 71%] Built target rs-pose-and-image
[ 72%] Built target rs-trajectory
[ 72%] Built target rs-ar-basic
[ 73%] Built target rs-ar-advanced
[ 74%] Built target rs-tracking-and-depth
[ 75%] Built target rs-hdr
[ 75%] Built target rs-convert
[ 75%] Built target rs-enumerate-devices
[ 76%] Built target rs-fw-logger
[ 77%] Built target rs-terminal
[ 78%] Built target rs-record
[ 79%] Built target rs-fw-update
[ 80%] Built target rs-data-collect
[ 88%] Built target realsense-viewer
[ 97%] Built target rs-depth-quality
[ 99%] Built target rs-rosbag-inspector
[100%] Built target rs-benchmark
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/librealsense2.so.2.41.0
-- Up-to-date: /usr/local/lib/librealsense2.so.2.41
-- Up-to-date: /usr/local/lib/librealsense2.so
-- Up-to-date: /usr/local/include/librealsense2
-- Up-to-date: /usr/local/include/librealsense2/hpp
-- Up-to-date: /usr/local/include/librealsense2/hpp/rs_types.hpp
-- Up-to-date: /usr/local/include/librealsense2/hpp/rs_context.hpp
-- Up-to-date: /usr/local/include/librealsense2/hpp/rs_processing.hpp
-- Up-to-date: /usr/local/include/librealsense2/hpp/rs_options.hpp
-- Up-to-date: /usr/local/include/librealsense2/hpp/rs_serializable_device.hpp
-- Up-to-date: /usr/local/include/librealsense2/hpp/rs_sensor.hpp
-- Up-to-date: /usr/local/include/librealsense2/hpp/rs_record_playback.hpp
-- Up-to-date: /usr/local/include/librealsense2/hpp/rs_export.hpp
-- Up-to-date: /usr/local/include/librealsense2/hpp/rs_frame.hpp
-- Up-to-date: /usr/local/include/librealsense2/hpp/rs_device.hpp
-- Up-to-date: /usr/local/include/librealsense2/hpp/rs_pipeline.hpp
-- Up-to-date: /usr/local/include/librealsense2/hpp/rs_internal.hpp
-- Up-to-date: /usr/local/include/librealsense2/rsutil.h
-- Up-to-date: /usr/local/include/librealsense2/rs_advanced_mode.h
-- Up-to-date: /usr/local/include/librealsense2/rs.h
-- Up-to-date: /usr/local/include/librealsense2/h
-- Up-to-date: /usr/local/include/librealsense2/h/rs_processing.h
-- Up-to-date: /usr/local/include/librealsense2/h/rs_frame.h
-- Up-to-date: /usr/local/include/librealsense2/h/rs_internal.h
-- Up-to-date: /usr/local/include/librealsense2/h/rs_types.h
-- Up-to-date: /usr/local/include/librealsense2/h/rs_sensor.h
-- Up-to-date: /usr/local/include/librealsense2/h/rs_pipeline.h
-- Up-to-date: /usr/local/include/librealsense2/h/rs_record_playback.h
-- Up-to-date: /usr/local/include/librealsense2/h/rs_device.h
-- Up-to-date: /usr/local/include/librealsense2/h/rs_option.h
-- Up-to-date: /usr/local/include/librealsense2/h/rs_context.h
-- Up-to-date: /usr/local/include/librealsense2/h/rs_advanced_mode_command.h
-- Up-to-date: /usr/local/include/librealsense2/h/rs_config.h
-- Up-to-date: /usr/local/include/librealsense2/rs_advanced_mode.hpp
-- Up-to-date: /usr/local/include/librealsense2/rs.hpp
-- Installing: /usr/local/lib/cmake/realsense2/realsense2Targets.cmake
-- Installing: /usr/local/lib/cmake/realsense2/realsense2Targets-noconfig.cmake
-- Installing: /usr/local/lib/cmake/realsense2/realsense2Config.cmake
-- Installing: /usr/local/lib/cmake/realsense2/realsense2ConfigVersion.cmake
-- Installing: /usr/local/lib/pkgconfig/realsense2.pc
-- Installing: /usr/local/lib/librealsense-file.a
-- Installing: /usr/local/lib/python3.6/pyrealsense2/pybackend2.cpython-36m-aarch64-linux-gnu.so.2.41.0
-- Installing: /usr/local/lib/python3.6/pyrealsense2/pybackend2.cpython-36m-aarch64-linux-gnu.so.2
-- Installing: /usr/local/lib/python3.6/pyrealsense2/pybackend2.cpython-36m-aarch64-linux-gnu.so
-- Installing: /usr/local/lib/python3.6/pyrealsense2/pyrealsense2.cpython-36m-aarch64-linux-gnu.so.2.41.0
-- Installing: /usr/local/lib/python3.6/pyrealsense2/pyrealsense2.cpython-36m-aarch64-linux-gnu.so.2.41
-- Installing: /usr/local/lib/python3.6/pyrealsense2/pyrealsense2.cpython-36m-aarch64-linux-gnu.so
-- Set runtime path of "/usr/local/lib/python3.6/pyrealsense2/pyrealsense2.cpython-36m-aarch64-linux-gnu.so.2.41.0" to ""
-- Installing: /usr/local/lib/cmake/pyrealsense2/pyrealsense2Targets.cmake
-- Installing: /usr/local/lib/cmake/pyrealsense2/pyrealsense2Targets-noconfig.cmake
-- Installing: /usr/local/lib/cmake/pyrealsense2/pyrealsense2Config.cmake
-- Installing: /usr/local/lib/cmake/pyrealsense2/pyrealsense2ConfigVersion.cmake
-- Installing: /usr/local/lib/librealsense2-gl.so.2.41.0
-- Up-to-date: /usr/local/lib/librealsense2-gl.so.2.41
-- Up-to-date: /usr/local/lib/librealsense2-gl.so
-- Set runtime path of "/usr/local/lib/librealsense2-gl.so.2.41.0" to ""
-- Up-to-date: /usr/local/include/librealsense2-gl/rs_processing_gl.h
-- Up-to-date: /usr/local/include/librealsense2-gl/rs_processing_gl.hpp
-- Installing: /usr/local/lib/cmake/realsense2-gl/realsense2-glTargets.cmake
-- Installing: /usr/local/lib/cmake/realsense2-gl/realsense2-glTargets-noconfig.cmake
-- Installing: /usr/local/lib/cmake/realsense2-gl/realsense2-glConfig.cmake
-- Installing: /usr/local/lib/cmake/realsense2-gl/realsense2-glConfigVersion.cmake
-- Installing: /usr/local/lib/pkgconfig/realsense2-gl.pc
-- Installing: /usr/local/bin/rs-hello-realsense
-- Set runtime path of "/usr/local/bin/rs-hello-realsense" to ""
-- Installing: /usr/local/bin/rs-software-device
-- Set runtime path of "/usr/local/bin/rs-software-device" to ""
-- Installing: /usr/local/bin/rs-capture
-- Set runtime path of "/usr/local/bin/rs-capture" to ""
-- Installing: /usr/local/bin/rs-callback
-- Set runtime path of "/usr/local/bin/rs-callback" to ""
-- Installing: /usr/local/bin/rs-save-to-disk
-- Set runtime path of "/usr/local/bin/rs-save-to-disk" to ""
-- Installing: /usr/local/bin/rs-multicam
-- Set runtime path of "/usr/local/bin/rs-multicam" to ""
-- Installing: /usr/local/bin/rs-pointcloud
-- Set runtime path of "/usr/local/bin/rs-pointcloud" to ""
-- Installing: /usr/local/bin/rs-align
-- Set runtime path of "/usr/local/bin/rs-align" to ""
-- Installing: /usr/local/bin/rs-align-advanced
-- Set runtime path of "/usr/local/bin/rs-align-advanced" to ""
-- Installing: /usr/local/bin/rs-sensor-control
-- Set runtime path of "/usr/local/bin/rs-sensor-control" to ""
-- Installing: /usr/local/bin/rs-measure
-- Set runtime path of "/usr/local/bin/rs-measure" to ""
-- Installing: /usr/local/bin/rs-depth
-- Set runtime path of "/usr/local/bin/rs-depth" to ""
-- Installing: /usr/local/bin/rs-color
-- Set runtime path of "/usr/local/bin/rs-color" to ""
-- Installing: /usr/local/bin/rs-distance
-- Set runtime path of "/usr/local/bin/rs-distance" to ""
-- Installing: /usr/local/bin/rs-post-processing
-- Set runtime path of "/usr/local/bin/rs-post-processing" to ""
-- Installing: /usr/local/bin/rs-record-playback
-- Set runtime path of "/usr/local/bin/rs-record-playback" to ""
-- Installing: /usr/local/bin/rs-motion
-- Set runtime path of "/usr/local/bin/rs-motion" to ""
-- Installing: /usr/local/bin/rs-gl
-- Set runtime path of "/usr/local/bin/rs-gl" to ""
-- Installing: /usr/local/bin/rs-pose
-- Set runtime path of "/usr/local/bin/rs-pose" to ""
-- Installing: /usr/local/bin/rs-pose-predict
-- Set runtime path of "/usr/local/bin/rs-pose-predict" to ""
-- Installing: /usr/local/bin/rs-pose-and-image
-- Set runtime path of "/usr/local/bin/rs-pose-and-image" to ""
-- Installing: /usr/local/bin/rs-trajectory
-- Set runtime path of "/usr/local/bin/rs-trajectory" to ""
-- Installing: /usr/local/bin/rs-ar-basic
-- Set runtime path of "/usr/local/bin/rs-ar-basic" to ""
-- Installing: /usr/local/bin/rs-ar-advanced
-- Set runtime path of "/usr/local/bin/rs-ar-advanced" to ""
-- Installing: /usr/local/bin/rs-tracking-and-depth
-- Set runtime path of "/usr/local/bin/rs-tracking-and-depth" to ""
-- Installing: /usr/local/bin/rs-hdr
-- Set runtime path of "/usr/local/bin/rs-hdr" to ""
-- Installing: /usr/local/bin/rs-convert
-- Set runtime path of "/usr/local/bin/rs-convert" to ""
-- Installing: /usr/local/bin/rs-enumerate-devices
-- Set runtime path of "/usr/local/bin/rs-enumerate-devices" to ""
-- Installing: /usr/local/bin/rs-fw-logger
-- Set runtime path of "/usr/local/bin/rs-fw-logger" to ""
-- Installing: /usr/local/bin/rs-terminal
-- Set runtime path of "/usr/local/bin/rs-terminal" to ""
-- Installing: /usr/local/bin/rs-record
-- Set runtime path of "/usr/local/bin/rs-record" to ""
-- Installing: /usr/local/bin/rs-fw-update
-- Set runtime path of "/usr/local/bin/rs-fw-update" to ""
-- Installing: /usr/local/bin/rs-data-collect
-- Set runtime path of "/usr/local/bin/rs-data-collect" to ""
-- Installing: /usr/local/bin/realsense-viewer
-- Set runtime path of "/usr/local/bin/realsense-viewer" to ""
-- Installing: /usr/local/bin/rs-depth-quality
-- Set runtime path of "/usr/local/bin/rs-depth-quality" to ""
-- Installing: /usr/local/bin/rs-rosbag-inspector
-- Set runtime path of "/usr/local/bin/rs-rosbag-inspector" to ""
-- Installing: /usr/local/bin/rs-benchmark
-- Set runtime path of "/usr/local/bin/rs-benchmark" to ""
zhihui@zhihui-desktop:~/librealsense/build$
编译完成之后,你会在:/usr/local/lib
下发现编译生成的librealsense2
动态库文件
zhihui@zhihui-desktop:/usr/local/lib$ ls
cmake librealsense2-gl.so librealsense2-gl.so.2.41.0 librealsense2.so.2.41 librealsense-file.a python2.7
libglfw3.a librealsense2-gl.so.2.41 librealsense2.so librealsense2.so.2.41.0 pkgconfig python3.6
zhihui@zhihui-desktop:/usr/local/lib$
同时在python3的库包存放位置/usr/local/lib/python3.6/pyrealsense2
,你也会看到生成的pyrealsense2
相关的动态库文件
zhihui@zhihui-desktop:/usr/local/lib/python3.6/pyrealsense2$ ls
pybackend2.cpython-36m-aarch64-linux-gnu.so pybackend2.cpython-36m-aarch64-linux-gnu.so.2.41.0 pyrealsense2.cpython-36m-aarch64-linux-gnu.so.2.41
pybackend2.cpython-36m-aarch64-linux-gnu.so.2 pyrealsense2.cpython-36m-aarch64-linux-gnu.so pyrealsense2.cpython-36m-aarch64-linux-gnu.so.2.41.0
zhihui@zhihui-desktop:/usr/local/lib/python3.6/pyrealsense2$ ^C
zhihui@zhihui-desktop:/usr/local/lib/python3.6/pyrealsense2$ ls
pybackend2.cpython-36m-aarch64-linux-gnu.so pybackend2.cpython-36m-aarch64-linux-gnu.so.2.41.0 pyrealsense2.cpython-36m-aarch64-linux-gnu.so.2.41
pybackend2.cpython-36m-aarch64-linux-gnu.so.2 pyrealsense2.cpython-36m-aarch64-linux-gnu.so pyrealsense2.cpython-36m-aarch64-linux-gnu.so.2.41.0
zhihui@zhihui-desktop:/usr/local/lib/python3.6/pyrealsense2$
但是,此时如果你在命令行中导入pyrealsense2
,虽然可以正确导入,但是并没有任何接口可以使用
zhihui@zhihui-desktop:~$ python3
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyrealsense2 as rs
>>> dir(rs)
['__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
>>>
6、添加动态库相关环境变量
vim ~/.bashrc
export PYTHONPATH=$PYTHONPATH:/usr/local/lib:/usr/local/lib/python3.6/pyrealsense2
再次导入pyrealsense2
可以成功运行编译的库包
zhihui@zhihui-desktop:~$ python3
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyrealsense2 as rs
>>> dir(rs)
['BufData', 'D400', 'DEPTH', 'L500', 'SR300', 'STAEControl', 'STAFactor', 'STCensusRadius', 'STColorControl', 'STColorCorrection', 'STDepthControlGroup', 'STDepthTableControl', 'STHdad', 'STRauColorThresholdsControl', 'STRauSupportVectorControl', 'STRsm', 'STSloColorThresholdsControl', 'STSloPenaltyControl', 'T200', 'TRACKING', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '__version__', 'adjust_2D_point_to_boundary', 'align', 'any', 'any_intel', 'auto_calibrated_device', 'calibrated_sensor', 'calibration_status', 'calibration_type', 'camera_info', 'color_sensor', 'colorizer', 'composite_frame', 'config', 'context', 'debug_protocol', 'debug_stream_sensor', 'decimation_filter', 'depth_frame', 'depth_huffman_decoder', 'depth_sensor', 'depth_stereo_sensor', 'device', 'device_calibration', 'device_list', 'disparity_frame', 'disparity_transform', 'distortion', 'dsm_params', 'event_information', 'extension', 'extrinsics', 'filter', 'filter_interface', 'firmware_log_message', 'firmware_log_parsed_message', 'firmware_logger', 'fisheye_sensor', 'format', 'frame', 'frame_metadata_value', 'frame_queue', 'frame_source', 'hdr_merge', 'hole_filling_filter', 'intrinsics', 'is_pixel_in_line', 'log', 'log_message', 'log_severity', 'log_to_callback', 'log_to_console', 'log_to_file', 'max_usable_range_sensor', 'motion_device_intrinsic', 'motion_frame', 'motion_sensor', 'motion_stream', 'motion_stream_profile', 'next_pixel_in_line', 'non_intel', 'notification', 'notification_category', 'option', 'option_range', 'options', 'pipeline', 'pipeline_profile', 'pipeline_wrapper', 'playback', 'playback_status', 'pointcloud', 'points', 'pose', 'pose_frame', 'pose_sensor', 'pose_stream', 'pose_stream_profile', 'processing_block', 'product_line', 'quaternion', 'recorder', 'region_of_interest', 'roi_sensor', 'rs2_deproject_pixel_to_point', 'rs2_fov', 'rs2_project_color_pixel_to_depth_pixel', 'rs2_project_point_to_pixel', 'rs2_transform_point_to_point', 'rs400_advanced_mode', 'save_single_frameset', 'save_to_ply', 'sensor', 'sequence_id_filter', 'software_device', 'software_motion_frame', 'software_notification', 'software_pose_frame', 'software_sensor', 'software_video_frame', 'spatial_filter', 'stream', 'stream_profile', 'syncer', 'temporal_filter', 'terminal_parser', 'texture_coordinate', 'threshold_filter', 'timestamp_domain', 'tm2', 'units_transform', 'updatable', 'update_device', 'vector', 'vertex', 'video_frame', 'video_stream', 'video_stream_profile', 'wheel_odometer', 'yuy_decoder', 'zero_order_invalidation']
>>> rs.pipeline()
<pyrealsense2.pipeline object at 0x7f940d0420>
>>>
2 使用pyrealsense2获取Intel 的tof相机视频流用例
import pyrealsense2 as rs
import numpy as np
import cv2# Configure depth and color streams
pipeline = rs.pipeline()
config = rs.config()
# config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
# config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30)config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30)# Start streaming
pipeline.start(config)try:while True:# Wait for a coherent pair of frames: depth and colorframes = pipeline.wait_for_frames()# 深度图depth_frame = frames.get_depth_frame()# 正常读取的视频流color_frame = frames.get_color_frame()if not depth_frame or not color_frame:continue# Convert images to numpy arraysdepth_image = np.asanyarray(depth_frame.get_data())color_image = np.asanyarray(color_frame.get_data())# print(f"depth_image shape: {depth_image.shape} color_image shape: {color_image.shape}")print(f"depth_image value: {depth_image}") # 里面0值很多,还有很多1900左右的值 300mm 单位是毫米=30厘米=0.3米# depth_image shape: (480, 640) color_image shape: (480, 640, 3)# 深度图是单通道 颜色图是三通道的# Apply colormap on depth image (image must be converted to 8-bit per pixel first)# 在深度图像上应用colormap(图像必须先转换为每像素8位)depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_image, alpha=0.03), cv2.COLORMAP_JET)# Stack both images horizontallyimages = np.hstack((color_image, depth_colormap))# Show imagescv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE)cv2.imshow('RealSense', images)cv2.waitKey(1)finally:# Stop streamingpipeline.stop()
zhihui@zhihui-desktop:/usr/local/bin$ ls
convert-caffe2-to-onnx jetson_config rs-align rs-capture rs-distance rs-hello-realsense rs-pose-and-image rs-save-to-disk
convert-onnx-to-caffe2 jetson_release rs-align-advanced rs-color rs-enumerate-devices rs-measure rs-pose-predict rs-sensor-control
cygdb jetson_swap rs-ar-advanced rs-convert rs-fw-logger rs-motion rs-post-processing rs-software-device
cython jtop rs-ar-basic rs-data-collect rs-fw-update rs-multicam rs-record rs-terminal
cythonize pasteurize rs-benchmark rs-depth rs-gl rs-pointcloud rs-record-playback rs-tracking-and-depth
futurize realsense-viewer rs-callback rs-depth-quality rs-hdr rs-pose rs-rosbag-inspector rs-trajectory
zhihui@zhihui-desktop:/usr/local/bin$
通过定时器实现视频流,用while循环获取视频流的方式,是第一帧获取完之后,立马去获取第二帧,这种方式会很消耗CPU资源,因此通过定时器获取视频流可以解决资源!
欢迎大家关注笔者,你的关注是我持续更博的最大动力
原创文章,转载告知,盗版必究
微信:suihailiang0816 QQ:931762054 wx公众号:仰望星空的小随
在Jetson Nano上编译 pyrealsense2库包,并在Intel的tof相机上进行测试相关推荐
- 在windows上编译apr库apr-util库
在windows上编译apr库apr-util库 环境: win10.VS2015企业版.CMake3.18.2 一.下载apr相关库 1.1)expat:expat-2.1.0.tar.gz 1.2 ...
- win10上编译libharu库
背景: 最近的项目需要自动的生成pdf文件,我在网上查看相关的资料,发现目前比较流行的生成pdf文件的库有两个,一个是libpdf,另一个是libharu.libpdf个人使用时免费的但是商业使用就需 ...
- linux 64 32 编译支持,在64位linux上编译32位程序 for i386 intel
编辑中 # ld -V GNU ld version 2.15.92.0.2 20040927 Supported emulations: elf_x86_64 elf_i386 i386linux ...
- boost1.55.0在vs2013上编译序列化库失败的解决方法
2019独角兽企业重金招聘Python工程师标准>>> 之前一直没有使用boost序列化的库,所以一直没法发现boost.155.0序列化库在vs2013下面编译通不过. 今天打算用 ...
- Jetson Nano——使用JetCam官方库调用双CSI摄像头
文章目录 环境准备 报错No nodule named 'traitlets' CSI摄像头测试代码 环境准备 参考官方配置方案: git clone https://github.com/NVIDI ...
- 【Google Play】APK 扩展包 ( 2021年09月02日最新处理方案 | 制作 APK 扩展包 | 上传 APK 扩展包到 Google Play | APK 扩展文件上传时机 )
文章目录 一.制作 APK 扩展包 二.上传 APK 和 主扩展文件到 Google Play 三.APK 扩展文件上传时机 一.制作 APK 扩展包 apk.txt 内容 : APK 扩展文件测试文 ...
- 64 win10位系统上编译出的32位的可执行程序到其他机器上无法运行_MoreThanJava计算机系统概述...
「MoreThanJava」 宣扬的是 「学习,不止 CODE」,本系列 Java 基础教程是自己在结合各方面的知识之后,对 Java 基础的一个总回顾,旨在 「帮助新朋友快速高质量的学习」. 当然 ...
- jetson nano 编译pyrealsense2 运行t265
在win10 的环境下,安装pyrealsense2 ,只需要简单的pip就可以了,没想到在jetson nano下却花了那么多时间和精力. 其实解决方案网上都有,但是比较零碎,只能遇到一个问题百度一 ...
- 在CentOS/Debian/Ubuntu上编译安装最新版 GCC 8 , cmake 3 和ninja
CentOS不像Debian/Ubuntu,不能直接从官方库中安装最新版的gcc/g++,只能源码编译安装. gcc下载地址:Index of /gnu/gcc 我选择了最新版本 gcc-8.3.0, ...
最新文章
- GitHub重大更新:在线开发上线,是时候卸载IDE了
- 基于Redis实现一个分布式锁
- C#应用NPOI实现导出EXcel表格中插入饼状图(可实现动态数据生成)
- Linux桌面环境与命令行环境切换快捷键,以及linux 图形界面 X Server 关闭 启动
- phpstuday 修改网站访问目录
- CSS中background-position的使用
- 基于360搜图爬取图片
- 斯坦福java下载_斯坦福解析器java错误
- canvas笔记-使用arc与lineTo画圆角矩形及绘制2048棋盘
- JAVA 计算地球上任意两点(经纬度)距离
- HTTP Status 404 - There is no Action mapped for...
- 图书馆系统java实训报告_基于Java的图书馆管理系统的设计实习报告
- 用C语言编程输出菱形图案
- 2018 年最流行的十大编程语言,Java 无可争议!
- shell 字符串匹配
- Webex助力Innokids消除沟通隔阂,成就无边界创作
- 【LeetCode】971. Flip Binary Tree To Match Preorder Traversal
- Android win10 平板 省电,Win10平板模式省电吗?如何设置?
- 文化算法 方向图综合 matlab,二维矩形阵列天线方向图综合
- Mobx 源码解析 二(autorun)