Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cvtColor(): Bayer conversion scrambled pixels (channels)

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:

image description

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.

cvtColor(): Bayer conversion scrambled pixels (channels)

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:

image description

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.

cvtColor(): Bayer conversion scrambled pixels (channels)

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:

image description

I have tried CV_8UC3 and setting raw.stride 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.

cvtColor(): Bayer conversion scrambled pixels (channels)(channels?)

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:

image description

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.

cvtColor(): Bayer conversion scrambled pixels (channels?)

I am a beginner 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_map;
video_image;
cv::Mat raw(640, 480, CV_8UC1, frame->buffer.data());
cv::cvtColor(raw, video_map, video_image, CV_BayerGB2BGR);
cv::imshow("video", video_map)
video_image)

BONUS QUESTION: Does the Mat constructor make a deep copy of the input data?

But video_map video_image looks like this:

image description

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.