Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Changing color space in opencv without changing color of the image

Hi, I am working on a project where I read an image load the data into Mat data type. The I do some operations on it. All my operations are done assuming the color space is RGB (BGR as opencv stores in that way). Everuything is working fine. I was doing experiment on converting the output image to YUV format. But when I transform the output image from BGR2YUV using the following command cvtColor(img,out,CV_RGB2YCrCb); I found that the resulting image color is changed completely.

How can I change the color space from RGB to YUV without changing the colors in the image? I

Changing color space in opencv without changing color of the image

Hi, I am working on a project where I read an image load the data into Mat data type. The I do some operations on it. All my operations are done assuming the color space is RGB (BGR as opencv stores in that way). Everuything is working fine. I was doing experiment on converting the output image to YUV format. But when I transform the output image from BGR2YUV using the following command cvtColor(img,out,CV_RGB2YCrCb); I found that the resulting image color is changed completely.

How can I change the color space from RGB to YUV without changing the colors in the image? IFor example, my output RGB image is green. WHen I convert this to YUV format and show the resulting image I found it blue and NOT green. I want a way to convert so that the output also become green.