comparing values of nodes inside grid

1 回表示 (過去 30 日間)
osama
osama 2014 年 5 月 16 日
Hi friends ,,, i just beginner in matlab and have some task ,, i making grid on image and trying to check the nodes of each segment of image then change it's values to 0 or 1 equal to the condition ,,, i made a loop but there is a mistake .. all image showed as black // please check and help ?? I = imread('lena64.bmp'); figure,imshow(I); hold on M = size(I,1); N = size(I,2); a=4; b=4; for k = 1:a:M x = [1 N]; y = [k k]; plot(x,y,'Color','black','LineStyle','-'); set(findobj('Tag','MyGrid'),'Visible','on') end for k = 1:b:N x = [k k]; y = [1 M]; plot(x,y,'Color','black','LineStyle','-'); set(findobj('Tag','MyGrid'),'Visible','on') end
for p=1:a:M for q=1:b:N
for h=4:a:M
for z=4:b:N
if (I(p,q)==I(h,z)==I(p,h)==I(z,q))
for k= p:h
for k2= q:z
I(k,k2)=0;
end
end
else
for k= p:h
for k2 = q:z
I(k,k2)=1;
end
end
end
end
end
end
end
figure,imshow(I);
hold off

回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by