【问题标题】:How to get the device information from the rs2::pipeline object?如何从 rs2::pipeline 对象中获取设备信息?
【发布时间】:2019-05-28 19:36:02
【问题描述】:

我有一个将 rs2::pipeline 作为参数的函数,我有多个 D435 和 T265 试图访问该函数。我想根据调用该函数的相机显示不同的信息,那么如何通过 rs2::pipeline 对象获取有关相机的信息。

rs2::device 有一个方法 get_info 提供有关相机的信息,但我不确定如何从 rs2::pipeline 引用 rs2::device。

void RenderCamera(rs2::pipeline pipe,int id){
    //Display the camera information here from the rs2::pipeline object
    ...
    ...
    ...
    imshow("Rendered_Window",frame_mat);

} 

我想在这里看到的结果是一个简单的调试语句,它给了我设备的信息。

【问题讨论】:

    标签: realsense


    【解决方案1】:

    rs::device 是获取设备信息所必需的,下面是获取相机信息的一种方式。对于这个设备需要启动和停止捕获,如果设备已经开始捕获,这是开销并且可能会导致一些副作用。始终牢记调用RenderCamera 函数的上下文。

        void RenderCamera(rs2::pipeline pipe,int id){    
             rs2::config config;             
             rs2::pipeline_profile pipeline_profile = pipeline.start(config); // camera starts capturing
             pipeline_profile = pipeline.start(config);
             rs2::device rs_dev = pipeline_profile.get_device();
             std::cout <<"Device Name"<<": "<< rs_dev.get_info(RS2_CAMERA_INFO_NAME)<<std::endl;
             std::cout <<"Firmware Version"<<": "<<rs_dev.get_info(RS2_CAMERA_INFO_FIRMWARE_VERSION)<<std::endl;
             std::cout <<"Serial Number"<<": "<<rs_dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER)<<std::endl;
             std::cout <<"Product Id"<<": "<<rs_dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID)<<std::endl;
             pipeline.stop(); // camera stops capturing     
             ----   
             ----    
        } 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      • 2018-06-09
      • 1970-01-01
      • 2019-08-19
      • 1970-01-01
      相关资源
      最近更新 更多