1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| clear all;
image_rgb=imread('255-0-0_255-30-30','tif')
image_rgb=double(image_rgb)/255;
imshow(image_rgb)
C = makecform('srgb2lab');
image_lab= applycform(image_rgb,C);
% on prend deux points : 1 et 2 (1 étant le point de référence)
L1=image_lab(2,2,1)
a1=image_lab(2,2,2)
b1=image_lab(2,2,3)
L2=image_lab(2,48,1)
a2=image_lab(2,48,2)
b2=image_lab(2,48,3)
C1=sqrt(a1*a1+b1*b1)
C2=sqrt(a2*a2+b2*b2)
H1=(atan(b1/a1))*(360/(2*pi))
H2=(atan(b2/a2))*(360/(2*pi))
if (L1<16)
SL=0.511;
else
SL=(0.040975*L1)/(1+0.01765*L1);
end
SC=0.638+(0.0638*C1)/(1+0.0131*C1);
F=sqrt((C1*C1*C1*C1)/((C1*C1*C1*C1)+1900))
if (H1>164)&&(H1<345)
T=0.56+abs(0.2*cos(168+H1));
else
T=0.36+abs(0.4*cos(35+H1));
end
SH=(F*T+1-F)*SC;
%paramètres ajustables
l=2;
c=1;
h=1;
DeltaL=L2-L1;
DeltaC=C2-C1;
DeltaH=H2-H1;
%DeltaH=2*sqrt(C1*C2)*sin((H2-H1)/2);
Delta=sqrt((DeltaL/(l*SL))*(DeltaL/(l*SL))+(DeltaC/(c*SC))*(DeltaC/(c*SC))+(DeltaH/(h*SH))*(DeltaH/(h*SH))) |
Partager