필터 지우기
필터 지우기

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 CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by