VS连接realsense D435i摄像头初始化(1)

本文介绍了在Windows 10环境下,使用Visual Studio 2019和C/C++连接Realsense D435i摄像头时遇到的三个问题及解决方案。包括glfw3.h找不到、API版本不匹配和rs-capture.cpp等无法生成的错误。解决方法涉及添加库目录、更新SDK版本和添加OpenGL库依赖。
摘要由CSDN通过智能技术生成

关于VS连接realsense摄像头的博客已经有很多了,这里我只列一下我连接过程中遇到的问题以及我是如何解决的。

  • 电脑系统:win10 x64
  • Visual Studio 2019
  • Realsense D435i摄像头
  • 使用语言:C,C++

问题一:首先我参照了该博客进行初步的构建,然后尝试运行rs-hello-realsense.cpp,结果出现了一批无法识别的函数,检查代码发现是example.hpp头文件中,glfw3.h文件无法找到在这里插入图片描述解决方案:找到文件夹third-party/glfw,按照之前的方法将example、include文件夹添加到库目录,同时将glfw3.lib添加到项目属性→链接器→输入→附加依赖项中。在这里插入图片描述

问题二:生成rs-hello-realsense.cpp解决方案成功后,运行,出现窗口,但是窗口内并非输出,而是报错,其中一端为

API version mismatch: librealsense.so was comp

  • 6
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
OpenCV是一个开源的计算机视觉库,可以用于处理图像和视频数据,包括读取和写入图像数据。 realsense d435i是英特尔推出的一款深度相机,可以获取深度信息和RGB图像。 要读取realsense d435i的RGB图像,可以使用OpenCV中的cv::VideoCapture类来实现。首先,需要安装realsense SDK并配置环境,然后在代码中初始化VideoCapture对象,并设置参数。 下面是一个简单的示例代码: ``` #include <opencv2/opencv.hpp> #include <librealsense2/rs.hpp> using namespace cv; using namespace rs2; int main(int argc, char* argv[]) { // Declare RealSense pipeline, encapsulating the actual device and sensors pipeline pipe; // Start streaming with default configuration pipe.start(); // Create a VideoCapture object to read from the RealSense camera VideoCapture cap(pipe); // Check if camera opened successfully if (!cap.isOpened()) { std::cout << "Error opening video stream or file" << std::endl; return -1; } // Read and display frames from camera while (1) { Mat frame; // Capture frame-by-frame cap >> frame; // If the frame is empty, break immediately if (frame.empty()) break; // Display the resulting frame imshow("RGB Image", frame); // Press Esc on keyboard to exit if (waitKey(1) == 27) break; } // When everything done, release the video capture object cap.release(); // Closes all the frames destroyAllWindows(); return 0; } ``` 这个程序中,我们首先声明一个RealSense pipeline对象pipe,然后启动流水线。接着我们创建一个VideoCapture对象cap,并将pipe传递给它以读取RGB图像。最后,在while循环中读取每一帧图像并显示它们。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值