Emag = imread('Emag.tif'); Edir = imread('Edir.tif'); subplot(2,2,1); imshow(Emag, []) subplot(2,2,2); imshow(Edir, []) [xs ys] = size(Emag); E = Emag > 10; subplot(2,2,3); imshow(E, []) for i=2:xs-1 for j=2:ys-1 if E(i,j)>0 if Edir(i,j)==2 if 0 E(i,j) = 0; end elseif Edir(i,j)==3 if 0 E(i,j) = 0; end elseif Edir(i,j)==4 if 0 E(i,j) = 0; end elseif Edir(i,j)==5 if 0 E(i,j) = 0; end end end end end subplot(2,2,4); imshow(E, [])