I want to subtract gray values of two images and want to make those regions as black where gray values doesn't match.But I am having problem in coding in the if condition where I want to compare gray values of images.
Show older comments
Please let me know how to get gary value of every pixel location and how to compare them.
The code what i have done is:
l= imread('B.jpg');
k= imread('BF.jpg');
L = rgb2gray(l);
K = rgb2gray(k);
for i=1:256
for j= 1:384
if L(i,j) == K(i,j)
K(i,j)=1;
else K(i,j)=0;
end
end
end
imshow(K);
but when i run this it shows a complete black image.
Accepted Answer
More Answers (0)
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!