realsense R200, difference between saved images and live stream?
Hi, I have a realsense r200 camera, and am using it with Stereo Odometry.
The images are converted to cv::mat like this:
Mat lFrame(480, 640, CV_16U, (uchar *)dev->get_frame_data(rs::stream::infrared));
which looks fine, and is from the docs.
When i save images out using:
cv::imwrite(name, img);
and run them through the third party Odometry library by loading the images, like this:
cv::Mat left_img = cv::imread(left_img_file_name.c_str(), 0); // load as black and white image
uint8_t* left_img_data = left_img.data;
Everything works great. BUT, when i use a live stream of images, like this:
Mat lFrame(480, 640, CV_16U, (uchar *)dev->get_frame_data(rs::stream::infrared));
uint8_t* left_img_data = lFrame.data;
It does not work at all.
I suspect this is due to a mismatch in Mat
types, but I am lost.
I have tried:
cv::cvtColor(lFrame, leftImg, CV_GRAY2RGB);
cv::cvtColor(lFrame, leftImg, CV_GRAY2BGR);
But I see no difference. Does anyone have any thoughts on what might be missing here?
..if it helps.. I have found an example by the author of the library. They used:
IplImage *I = cvCreateImageHeader(cvSize(dc_frame->size[0],dc_frame->size[1]),IPL_DEPTH_8U,1);
cvSetData(I,dc_frame->image,dc_frame->size[0]);
Thank you!
run them through the third party Odometry library
then your best guess is that you just get this solved with guys using that library. Not really sure if this is the best place to do so.Hi, Thanks for your response. I am just wondering if there is anything obvious that it could be. Is there any obvious difference in the Mat types from the example code to the code I am using? Is there any other 16 bit Mat type I could try? Thanks again!
@stillNovice, is your project open source? Can you provide a link?