I am a beginner to OpenCV. I am trying to convert a cv::Mat of Bayer data to BGR. The input data is a 640*480 array of uint8_t. My code looks like this:
cv::Mat video_map;
cv::Mat raw(640, 480, CV_8UC1, frame->buffer.data());
cv::cvtColor(raw, video_map, CV_BayerGB2BGR);
cv::imshow("video", video_map)
But video_map looks like this:
I have tried CV_8UC3 and setting raw.stride to 640*3. What am I missing?
PS: I took a screenshot because the highgui save image button had no apparent effect on the filesystem.