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:
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,dc_frame->size),IPL_DEPTH_8U,1); cvSetData(I,dc_frame->image,dc_frame->size);