MATLAB: How to find row and column of a pixel in an Image

MATLABto find rows and columns of pixel in image

Guys I want to find the rows and columns of pixels of image so that i can put that in if condition inside for loop. Bt i am unable to write that code. plz help me.

Best Answer

Hi, what about this:
[ROWS,COLUMNS] = ndgrid(1:size(I,1),1:size(I,2));
ROWS = ROWS(:);
COLUMNS = COLUMNS(:);
where I is your image.
Best regards, Wolfgang