g1(h*ab) = 0.116|sin((h*ab-90)/2)|+0.085
Show older comments
Please go through the code and tell me what is wrong.. Thankyou
% Lightness Correction
% **************************************************************************************
% L* for the lightness and a* and b* for the green–red and blue–yellow color components
[L,a,b] = RGB2Lab(IC);
%RGB2LAB Convert an image from RGB to CIELAB
% Calculating CIELAB Coordinate
% C_ab=(((a.^2)+(b.^2)).^0.5); %Chroma (magnitude) :: C*ab = [a*2 + b*2]^2
C_ab=sqrt((a.^2)+(b.^2));
% C_ab=(((a.^2)+(b.^2)).^0.5);
t_Hab=(b./a);
H_ab=atand(t_Hab);%Hue (angle):: h*ab = tan^-1(b*/a*)
% g2(L*) = 2.5 * 0.025L.
g2 = (2.5 -(0.025.*L));
** %g1(h*ab) = 0.116|sin((h*ab-90)/2)|+0.085,
g1_hab=((H_ab-90)./2);
g1=0.116.*(abs(sind(g1_hab)))+0.085;*
%L** = L* + g2(L*)g1(h*ab)C*ab,
tt=(g2.*g1.*C_ab);
Correct_Light=(L+tt);
figure,
imshow(Correct_Light);
2 Comments
Steven Lord
on 26 Jun 2018
What makes you believe that something is wrong?
If you receive an error when you run the code, show us the full text (everything in red) of the error message.
If you receive a different answer than you expected, show us how you defined the variables needed to run the code, show the results you received when you ran the code using those variables, and explain what you expected to receive.
cheppu mol
on 26 Jun 2018
Edited: cheppu mol
on 26 Jun 2018
Answers (1)
Hi,
there are at least 2 things to do in your code:
- Get rid of the 2 * in beginning of line 18 and the * at the end of line 20
- use rgb2lab instead of 'RGB2Lab' in line 4 (or did you write your own RGB2Lab-function? Then ignore this hint)
>> y = |sin(1.5*pi)|
y = |sin(1.5*pi)|
↑
Error: Unexpected MATLAB operator.
>> y = abs(sin(1.5*pi))
y =
1
>> y = sin(1.5*pi)
y =
-1
Best regards
Stephan
Categories
Find more on Number Theory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!