Question

I got a bitmap as a source;

I created a Emgu image with Image<Bgr,Byte> img = new Image<Bgr,Byte>(bmp);

I converted it to a YCbCr image using Image<Ycc,Byte> YCB = img.Convert<Ycc,Byte>();

I dragged a imagebox from the toolbox and assigned it with YCB -----> imagebox1.Image=YCB;

but the result shows the image in RGB format just like source bitmap

I don't understand where went wrong

Could someone give me some clues?

Was it helpful?

Solution

Have you made any alterations to YCB? If you simply display it then it will look identical to the original.

If you right click on your imagebox when running your program and select property it will tell you the type of image and show you the data held within the YCB image this should be different from your original. Alternatively just show 1 channel of your image matrix so for your BGR show the blue colour this will obviously be displayed as a single colour grayscale image. Now for the YCB show the Luma channel again this will be displayed as a single colour grayscale image. You will notice a slight change between them as the luma represents the luminance of all 3 colour spectrums.

            CvInvoke.cvShowImage("Blue", img [0]);
            CvInvoke.cvShowImage("Luma", YCB[0]);

If you want to see a greater difference multiply the Luma by 2 and you have a completely different image.

            YCB[0] *= 2;
            CvInvoke.cvShowImage("Luma Change", YCB);

The CvInvoke.cvShowImage() method is a great tool for debugging your code and seeing what your code is doing to images step by step.

For the benefits of others Ycc is YCbCr colour space: http://en.wikipedia.org/wiki/YCbCr

Cheers,

Chris

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top