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

Mat image creation from buffer data

$
0
0
Hello, I have float x, float y, float z values of an image. I want to construct a 16 bit png depth image by copying the z values. The image I am getting as a result has some invalid points. Below is my code. uint16_t* depthValues = new uint16_t[size]; auto sampleVector(DepthPoints); for (unsigned int i = 0; i < sampleVector.size(); i++) { depthValues[i] = (sampleVector.at(i).z) * 65536; } Mat newDepthImage = cv::Mat(var.height, var.width, CV_16UC1,depthValues); imwrite(Location, CImage); Can someone tell me, if I can copy the float values into an unsigned char array to create the image? Is that why my image has invalid points?

Viewing all articles
Browse latest Browse all 19555

Trending Articles



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