Why does opencv swap color channel when we explicitly mention CV_BayerRG2RGB?
I am converting bayer raw images into 3 channel color image using cvtColor() API. Though I am explicitly mentioning the result image in RGB (CV_BayerRG2RGB) opencv returns image in BGR format. Is this a bug or expected behavior? if expected, then should i convert it again using CV_BGR2RGB?
Without code it is difficult to say if it is a bug or not. How do you display your image?
For example, from camera i get raw bayer RG image buffer. I created a Mat object and pointing to bayer image buffer something like below,
Mat bayerImg = Mat(1200,1600, CV_8UC1, bayerBuffer); Mat rgbImg = Mat(1200,1600, CV_8UC3); cvtColor(bayerImg, rgbImg, COLOR_BayerRG2RGB_EA);
If i extract color channels from the above rgbImg, i get Blue channel first and Red channel last. I don't want to display it. I want to consume the buffer inside my application.
Here i am requesting for RGB why does opencv return BGR image?
in issue you can find : https://github.com/opencv/opencv/issu...
and all constants are here Hence RGB space seems equal to BGR space.
You can post an issue and gives other issue in reference and this post too
Do you use opencv 3.0 and vs 2010?
Yes Berger.
You should update to 3.4.1