Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

3D clod point to 2D image

$
0
0
Hello, I have 3D point cloud data which I want to convert into 2D image and save to the disk as 16 bit png image. I am using projectPoints() function which is giving me the projected points in the form vector<>point2d> which is a 2 channel image which i cannot use in imWrite(). Is there any other way to do this? Kindly help. Code: std::vector objectPoints; std::vector imagePoints; projectPoints(objectPoints, rVec, tVec, intrisicMat, distCoeffs, imagePoints); depthImage = Mat(imagePoints); imwrite("E:/softwares/1.8.0.71/bin/depthImage1.png", depthImage); I am getting assertion failed error because of the channel value. I have also tried the below code which is a 24 bit png image. Can I convert this to 16 bit? Mat depthImage = cv::Mat(height, width, CV_32FC3); int i = 0; for (int h = 0; h < depthImage.rows; h++) { for (int w = 0; w < depthImage.cols; w++) { depthImage.at(h, w)[0] = imagePoints[i].x ; depthImage.at(h, w)[1] = imagePoints[i].y; depthImage.at(h, w)[2] = 1; i++; } }

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>