Effacer les filtres
Effacer les filtres

comparing values of nodes inside grid

1 vue (au cours des 30 derniers jours)
osama
osama le 16 Mai 2014
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

Réponses (0)

Catégories

En savoir plus sur Image Segmentation and Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by