how to split darker and brighter pixels using a threshold value?
Show older comments
in=imread('window.jpg');
i_in=im2double(in);
i_in=imresize(i_in,[4 4]);
imshow(i_in);
figure(1);
%%LOGRATHIMIC NORMALIZATION
do=rgb2ycbcr(i_in);
% % Extract color
%logarithmic Normalization.
y =do(:,:,1); % Luminance channel
cb =do(:,:,2); % chroma blue channel
cr =do(:,:,3); % chroma red channel
Lin=0.299*do(:,:,1)+0.587*do(:,:,2)+0.114*do(:,:,3);
x=(max(max(Lin)))+1;
Llog=((log(Lin)+1)/log(x));
figure(2);
imshow(Llog);
A=Llog;
%splitting darker and bright pixels
m=4;
%For bright areas
for x=1:m
for y=1:m
if A(x,y)>0.5
b(x,y)=A(x,y);
end
end
end
%for dark areas
for x=1:m
for y=1:m
if A(x,y)<0.5
d(x,y)=A(x,y);
end
end
end
In the above code i got an error on bright area..In b(x,y) i only need pixels values which is greater than threshold,but i didnt get it..I have attached the Input and Bright values of an image for your reference.can you tell me what mistake i have done..
Accepted Answer
More Answers (0)
Categories
Find more on Computer Vision with Simulink 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!