cvtColor(): Bayer conversion scrambled pixels (channels?)
I am new 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_image;
cv::Mat raw(640, 480, CV_8UC1, frame->buffer.data());
cv::cvtColor(raw, video_image, CV_BayerGB2BGR);
cv::imshow("video", video_image)
BONUS QUESTION: Does the Mat constructor make a deep copy of the input data?
But video_image looks like this:
I have tried CV_8UC3 and setting raw.step 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.