RGB to YUV color space conversion for a image
Can anybody help me out with the complete method/code/inbuilt library function for converting an rgb mat image to an yuv color space.
Can anybody help me out with the complete method/code/inbuilt library function for converting an rgb mat image to an yuv color space.
It is very simple, you just have to know that YUV is as good as the same as YCrCb color space, the second one is for digital tv compared to YUV being for analogue tv signals, but the results are quite similar.
Mat original_image = imread("path_to_image");
Mat converted_image = original.clone();
cvtColor(original_image, converted_image, CV_BGR2YCrCb);
Do mind that openCV doesn't read images in RGB order but in BGR order!
Isn't it true that the BGR image is 3 channel, 24 bits per pixel and padded with additional 8 bits to make it 32-bits per pixel? How is the YCrCb image representation done? It would be 3 channel (2 for Y, 1 for Cr and 1 for Cb), but would it be 24-bits per pixel or 32-bits per pixel? What exact member variable of converted_image matrix be different from original_image matrix?
Asked: 2014-02-26 05:27:10 -0600
Seen: 14,758 times
Last updated: Feb 26 '14