Could someone please explain to me what the code below does?especially the part after the image is converted to ycbcr ... i m new to matlab . i found this on this on some site? your help will be greatly appreciated.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
nspace1=rgb2ycbcr(ims);
nspace2= rgb2ycbcr(imt);
ms=double(nspace1(:,:,1));
mt=double(nspace2(:,:,1));
m1=max(max(ms));
m2=min(min(ms));
m3=max(max(mt));
m4=min(min(mt));
d1=m1-m2;
d2=m3-m4;
% Normalization
dx1=ms;
dx2=mt;
dx1=(dx1*255)/(255-d1);
dx2=(dx2*255)/(255-d2);
[mx,my,mz]=size(dx2);
0 comentarios
Respuesta aceptada
Image Analyst
el 3 de Oct. de 2012
From the help, "If the input is uint8, YCBCR is uint8, where Y is in the range [16 235], and Cb and Cr are in the range [16 240]. If the input is a double, Y is in the range [16/255 235/255] and Cb and Cr are in the range [16/255 240/255]. If the input is uint16, Y is in the range [4112 60395] and Cb and Cr are in the range [4112 61680]."
Is your ims and imt uint8 or floating point?
If it's uint8, then Y goes between 16 and 240. So d1 = 224 (at most), and dx1 for the brightest (240) would be 240*255 / (255 - 224) = 1974.2. And the 16 would map to 16*255 / (255-224) = 131.6129. So the Y (luminance channel gets mapped from a possible range of 16-240 to a new range of 131.6-1974.2. I don't understand how normalization into this range would be useful.
0 comentarios
Más respuestas (1)
n
el 16 de Oct. de 2012
2 comentarios
Image Analyst
el 16 de Oct. de 2012
You're copying the red channel into the green channel and the blue channel. So it will be an RGB color image but will appear as grayscale because all three color channels are the same (the same as the original red channel).
redChannel = imt(:, :, 1);
greenChannel = imt(:, :, 2);
blueChannel = imt(:, :, 3);
but now you have all three being the redChannel because you copied it in.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!