• DepthAI
  • Converting dai::ImgFrame to cv::Mat

Hello,

Im writing an own Camera class in C++.

In this function:

cv::Mat Mono_camera::get_data(dai::Device& device) {

std::shared_ptr<dai::DataOutputQueue> mono_queue = device.getOutputQueue("mono_right_out", 4, false);

auto inMono = mono_queue->get<dai::ImgFrame>();

if(inMono){

cv::Mat frame = inMono->getCvFrame();

}

return frame;

}

Im getting the following error message:
error: conversion from ‘void’ to non-scalar type ‘cv::Mat’ requested

11 | cv::Mat frame = inMono->getCvFrame();

  • jakaskerl replied to this.
  • Linking to depthai::opencv instead of depthai::core solved the problem

    jhund
    The method should return a cv::Mat...
    Maybe try with getFrame().

    Thanks,
    Jaka

    12 days later

    Linking to depthai::opencv instead of depthai::core solved the problem

      5 months later

      jhund hello,I met a similar question in
      /usr/local/include/depthai/pipeline/datatype/PointCloudData.hpp

      error: conversion from ‘void’ to non-scalar type ‘pcl:: PointCloud<[pcl:: PointXYZ](pcl:😛ointXYZ)>:: Ptr’ {aka ‘boost::shared_ptr<pcl:: PointCloud[pcl:: PointXYZ](pcl:😛ointXYZ) >’} requested

      78 | pcl:: PointCloud[pcl:: PointXYZ](pcl:😛ointXYZ):😛tr cloud = pclMsg->getPclData();

      do you know what I should link to solve this quetion
      I have tried depthai::pcl ,but it is not true

        yyh0702
        How did you build the depthai library?
        To enable PCL support, follow the readme.

        Thanks,
        Jaka