I need to scan a (half of) binary image and store (or mark) only the position of first black pixel. I tried this out in matlab. But the code is displaying the positions of all the black pixels. My code is something like this.
I= imread('binary image');
imshow(I);
[r c] =size(I);
for j=1:c/2
for i=1:r
if(I(i,j)==1)
[i j]
end
end
end
Any suggestions to improve this…
You need to exit from the loops: