Imagine you have a sRGB image and you would like to convert it into lab color space.
So, how does it work ? It is calculated in two main steps
Since it is hard to see the difference from the above image, we can plot their difference
So, how does it work ? It is calculated in two main steps
- sRGB to XYZ color space
- XYZ to Lab color space
During this color space conversion one of the major choice is the adapted white point. Let me show an example why adapted white matters! let us use the following image.
Fig 1: We will use this "peppers" image to show how choice of white point matters. |
Please run the following code
I=imread('peppers.png');
I=imread('peppers.png');
figure, imshow(I);
srgb2lab_byA = makecform('srgb2lab', 'AdaptedWhitePoint',whitepoint('a'));
srgb2lab_byD50 = makecform('srgb2lab', 'AdaptedWhitePoint',whitepoint('d50'));
lab_A = applycform(I,srgb2lab_byA);
lab_D50 = applycform(I,srgb2lab_byD50);
figure;
subplot(1,2,1),imshow(lab_A(:,:,1)); title('sRGB to Lab by adapting to illuminant A');
subplot(1,2,2),imshow(lab_D50(:,:,1)); title('sRGB to Lab by adapting to illuminant D50');
luminance_diff=abs(lab_A(:,:,1)-lab_D50(:,:,1));
figure;% luminance difference is 40times enhanced for visualization
imshow(luminance_diff*40); title('luminance channel difference(40times enhanced for visualization) between A and D50');
Fig2 : sRGB2LAB conversion using illuminant A vs using illuminant D50 |
Since it is hard to see the difference from the above image, we can plot their difference
Fig3: Luminance difference while converting sRGB2lab using illuminant A vs illuminant D50; Original difference is multiplied with 40 for visualization only |
No comments:
Post a Comment
Please ask if anything is not clear enough..........