将Opencv Mat类型转换为pcl点云

时间:2019-07-16 14:33:33

标签: c++ opencv

用于(自动&& s:传感器)       {

      auto const v = Scoped(s->GetData(svp2_api::Mjpeg));
      if (v != nullptr)
      {
          pointClouds.emplace_back(v->GetImage());
          std::cout << pointClouds.back().channelCount << std::endl;
          std::cout << pointClouds.back().channelType << std::endl;
          std::cout << "Viz point Cloud\n";
          int type = type = CV_8UC(pointClouds.back().channelCount);
          cv::Mat tmp = cv::Mat(pointClouds.back().height, pointClouds.back().width, type, pointClouds.back().data);
          imshow("Point Cloud",tmp);
          cv::waitKey(1);
      }

      auto const W = Scoped(s->GetData(svp2_api::PointCloud));
      if (W != nullptr)
      {
          // convert point cloud data from intenta type to opencv type
          pointClouds.emplace_back(W->GetImage());
          int type = GetMatChannelType(pointClouds.back());
          std::cout << "Viz point Cloud\n";
          //int type = type = CV_32FC(pointClouds.back().channelCount);
          cv::Mat tmp = cv::Mat(pointClouds.back().height, pointClouds.back().width, type, pointClouds.back().data);
          imshow("Point Cloud 1", tmp);
          // convert point cloud data from opencv type to pcl type
          // for developing and debuging add argument to the project properties --> every run or test available 
          // 0. pcl header files an library to the software project multisensor
          // 1. declare pcl variables
          // 2. must write /transfer image data from opencv mat to pcl format
          // Note:  1. check data type opencv --> find similar data type for pcl
          //        

          cv::waitKey(1);
      }

  }

}

//我有一个包含点云数据的流文件。我已经将其转换为opencv:Mat类型,现在我的目标是将其转换为pcl :: pointcloud类型

0 个答案:

没有答案