RealSenseID
RealSenseID copied to clipboard
How convert RealSenseID::Image RAW10_1080P to cv::Mat or What image format have array RealSense ID::Image::buffer?
I'm trying to convert Image RealSenseID::RAW10
to cv::Mat
. I get an image from PreviewImageReadyCallback
, as shown in the example: https://github.com/IntelRealSense/RealSenseID/blob/master/samples/cpp/preview.cc#L14. But in the finish, I have always gray square. The conversation I make like:
(previewMode=RAW10_1080P)
void ConvertToMat(unsigned char * buffer, unsigned int width, unsigned int height) {
cv::Mat rgb;
cv::Mat raw10Img(image.height, image.width, CV_16UC1, image.buffer);
cv::cvtColor(raw10Img, rgb, cv::COLOR_BayerRG2RGB);
cv::imwrite("myimage.png", rgb);
}
From web-camera API: Callback will be used to provide RGB preview image and into samples/README.md: Run preview for few seconds. Preview callback prints information on each frame.images are rgb24 I’ll take that as "API return raw data in RGB format", but code bellow don’t work:
cv::Mat rgb;
cv::Mat raw10Img(image.height, image.width, CV_8UC3, image.buffer);
cv::cvtColor(raw10Img, rgb, cv::COLOR_BGR2RGB);
cv::imwrite("myimage.png", rgb);
What image format have array RealSense ID::Image::unsigned char * buffer
in void On Preview ImageReady(const RealSense ID::Image image)
when preview Mode=RAW10_1080P
? And how much channels in frame?