i have a gray scale image. i would like to scan column by column to find the location of the darkest pixel in each column, obtain the (x,y) locations and plot a mark on it. the output of the prog should be an image with marks on each column's darkest pixel.
my attempt resulted in no output at all. please help me.
[row col] =size(i11);
for j=1:col
for i=1:row
darkestPixelValue = min(i11(i,j));
[i,j]=find(i11==darkestPixelValue);
plot (i,j);
end
end
Use the second output argument of min
:
>> [mn row] = min( i11, [], 1 );
>> figure; imshow( i11 ); hold on; scatter( 1:size(i11,2), row, 40, 'xr' );