我已经在我的Xubuntu 16.04上安装了Intel OpenVino工具包,其示例旨在用于网络摄像头或类似的uvcvideo来源。
我一直在尝试更新这些示例以与Intel Realsense R200相机配合使用。
我已经用ros尝试了R200,它可以正常工作。我还安装了librealsense旧版库。
一切似乎都很好,但是我在移植时遇到了一些麻烦。
我添加了图书馆:
// librealsense C++ header file
#include <librealsense/rs.hpp>
然后创建必要的变量:
using namespace rs;
// Window size and frame rate
int const INPUT_WIDTH = 320;
int const INPUT_HEIGHT = 240;
int const FRAMERATE = 60;
// Named windows
char const *WINDOW_DEPTH = "Depth Image";
char const *WINDOW_RGB = "RGB Image";
context _rs_ctx;
//device * _rs_camera = _rs_ctx.get_device(0);
device* _rs_camera = NULL;
intrinsics _depth_intrin;
intrinsics _color_intrin;
bool _loop = true;
我还添加了一些功能:
bool display_next_frame( )
{
// Get current frames intrinsic data.
_depth_intrin = _rs_camera->get_stream_intrinsics( rs::stream::depth );
_color_intrin = _rs_camera->get_stream_intrinsics( rs::stream::color );
// Create depth image
cv::Mat depth16( _depth_intrin.height,
_depth_intrin.width,
CV_16U,
(uchar *)_rs_camera->get_frame_data( rs::stream::depth ) );
// Create color image
cv::Mat rgb( _color_intrin.height,
_color_intrin.width,
CV_8UC3,
(uchar *)_rs_camera->get_frame_data( rs::stream::color ) );
// < 800
cv::Mat depth8u = depth16;
depth8u.convertTo( depth8u, CV_8UC1, 255.0/1000 );
imshow( WINDOW_DEPTH, depth8u );
cvWaitKey( 1 );
cv::cvtColor( rgb, rgb, cv::COLOR_BGR2RGB );
imshow( WINDOW_RGB, rgb );
cvWaitKey( 1 );
return true;
}
// Initialize the application state. Upon success will return the static app_state vars address
bool initialize_streaming( )
{
bool success = false;
if( _rs_ctx.get_device_count( ) > 0 )
{
_rs_camera = _rs_ctx.get_device( 0 );
_rs_camera->enable_stream( rs::stream::color, INPUT_WIDTH, INPUT_HEIGHT, rs::format::rgb8, FRAMERATE );
_rs_camera->start( );
success = true;
}
return success;
}
但是在使用工具包随附的./build_samples.sh脚本编译我编辑的main.cpp时。
我无法解决这些未定义的引用问题:
[100%]链接CXX可执行文件 ../intel64/Release/interactive_face_detection_sample CMakeFiles / interactive_face_detection_sample.dir / main.cpp.o:在 函数
display_next_frame()': main.cpp:(.text+0x6af): undefined reference to
rs_get_stream_intrinsics的main.cpp :(。text + 0x72e): 对rs_get_stream_intrinsics' main.cpp:(.text+0x7ae): undefined reference to
rs_get_frame_data的未定义引用 main.cpp :(。text + 0x8d8):未定义对rs_get_frame_data' CMakeFiles/interactive_face_detection_sample.dir/main.cpp.o: In function
initialize_streaming()'的引用:main.cpp :(。text + 0xed9):未定义 对rs_get_device_count' main.cpp:(.text+0xf07): undefined reference to
rs_get_device'main.cpp的引用:(。text + 0xf49):未定义 参考rs_enable_stream_ex' main.cpp:(.text+0xf6e): undefined reference to
rs_start_source' CMakeFiles / interactive_face_detection_sample.dir / main.cpp.o:在 函数rs::context::~context()': main.cpp:(.text._ZN2rs7contextD2Ev[_ZN2rs7contextD5Ev]+0x6): undefined reference to
rs_delete_context' CMakeFiles / interactive_face_detection_sample.dir / main.cpp.o:在 函数rs::error::error(rs_error*)': main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x2e): undefined reference to
rs_get_error_message' main.cpp :(。text._ZN2rs5errorC2EP8rs_error [_ZN2rs5errorC5EP8rs_error] + 0x68): 对rs_get_failed_function' main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x79): undefined reference to
rs_get_failed_function的未定义引用 main.cpp :(。text._ZN2rs5errorC2EP8rs_error [_ZN2rs5errorC5EP8rs_error] + 0xad): 未定义对rs_get_failed_args' main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0xbe): undefined reference to
rs_get_failed_args的引用 main.cpp :(。text._ZN2rs5errorC2EP8rs_error [_ZN2rs5errorC5EP8rs_error] + 0xf5): 未定义对rs_free_error' CMakeFiles/interactive_face_detection_sample.dir/main.cpp.o: In function
rs :: log_to_console(rs :: log_severity)'的引用: main.cpp :(。text._ZN2rs14log_to_consoleENS_12log_severityE [_ZN2rs14log_to_consoleENS_12log_severityE] + 0x22): 未定义对rs_log_to_console' CMakeFiles/interactive_face_detection_sample.dir/main.cpp.o: In function
main的引用:main.cpp :(。text.startup + 0x134):未定义的引用 到rs_get_frame_data' main.cpp:(.text.startup+0xdeb): undefined reference to
rs_is_device_streaming'main.cpp :(。text.startup + 0xe1b): 对rs_wait_for_frames' CMakeFiles/interactive_face_detection_sample.dir/main.cpp.o: In function
_ GLOBAL__sub_I__ZN3fLB7FLAGS_hE'的未定义引用: main.cpp :(。text.startup + 0x496f):未定义的引用 `rs_create_context'collect2:错误:ld返回1退出状态 Interactive_face_detection_sample / CMakeFiles / interactive_face_detection_sample.dir / build.make:117: 目标'intel64 / Release / interactive_face_detection_sample'的配方 失败的制作[2]: * [intel64 / Release / interactive_face_detection_sample]错误1 CMakeFiles / Makefile2:254:目标配方 'interactive_face_detection_sample / CMakeFiles / interactive_face_detection_sample.dir / all' 失败的制作[1]:* [interactive_face_detection_sample / CMakeFiles / interactive_face_detection_sample.dir / all] 错误2 Makefile:127:目标“全部”的配方失败:*** [全部] 错误2
我的完整代码是: https://gist.github.com/mustafaxfe/7a3b26da2d28e72c933f15a05f5db85c