I am converting RGB to YCBCR image but reverse is not working.

9 views (last 30 days)
I want to convert RGB image to YCBCR by using rgb2ycbcr, it is working but when I am using ycbcr2rgb to get back image then it is now converting properly.
  2 Comments
Balkar Singh
Balkar Singh on 16 Aug 2021
You are right, pixel value are not exactly the same as the orginal value.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 16 Aug 2021
The below images would show color if there was notable difference between the original image and the reconstructed image. But there isn't -- the maximum change during the reconstruction process is 2 out of 256.
imgrgb = imread('flamingos.jpg');
imgy = rgb2ycbcr(imgrgb);
imgrgb2 = ycbcr2rgb(imgy);
max(abs(double(imgrgb) - double(imgrgb2)),[],'all')
ans = 2
imshowpair(imgrgb(:,:,1), imgrgb2(:,:,1));
imshowpair(imgrgb(:,:,2), imgrgb2(:,:,2));
imshowpair(imgrgb(:,:,3), imgrgb2(:,:,3));

More Answers (1)

Balkar Singh
Balkar Singh on 16 Aug 2021
You are right, pixel value are not exactly the same as the orginal value.
  2 Comments
Balkar Singh
Balkar Singh on 16 Aug 2021
Please consider the example given by Walter Roberson, what i have to add in that example.

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!