保存

MyData.h_people_depth = cv::cuda::GpuMat(PROJECTION_HEI, PROJECTION_WID, CV_32FC1, cv::Scalar(0, 0, 0));

cv::Mat people_depth;
MyData.h_people_depth.download(people_depth);


cv::Mat people_depth_save(people_depth.rows, people_depth.cols, CV_8UC4, people_depth.data);
cv::normalize(people_depth, people_depth, 0, 1.0, cv::NORM_MINMAX);

cv::imshow("people_depth", people_depth);
cv::imshow("people_depth_save", people_depth_save);
cv::imwrite("../res/people_depth.png", people_depth_save);

读取

Mat depth = imread("../res/people_depth.png", IMREAD_UNCHANGED);

for(int i=0;i<depth.rows;i++){
        for(int j=0;j<depth.cols;j++){
            if(depth.at<float>(i,j) > 0)
                printf("%f \n",depth.at<float>(i,j));

            Point2d p1 = pixel2cam(Point2d(i,j),K1);
     }
}

 

相关文章:

  • 2021-06-23
  • 2021-04-04
  • 2021-07-26
  • 2022-01-21
  • 2022-12-23
  • 2021-09-24
  • 2021-12-02
  • 2022-12-23
猜你喜欢
  • 2021-05-16
  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
相关资源
相似解决方案