how to mark the highest white pixel through bottom to the top? using grayscale image.
Show older comments


%point location
row=find(sum(img8,2)==0,1,'last')+1;
col=find(img8(row,:)~=0);
row=row(ones(size(col)));
Points=[row(:) col(:)];
imshow(img8);
hold on
plot(Points(:,2),Points(:,1)','rp','MarkerSize',12)
a=text(Points(1,2),Points(1,1),['This is (col,row)(',num2str(Points(1,2)),',',num2str(Points(1,1)),')']);
set(a, 'FontName', 'Arial' ,'FontWeight', 'bold', 'FontSize', 12,'Color', 'blue');
hold off
2 Comments
Image Analyst
on 1 Nov 2015
What do you mean by highest? The lowest row value? Or the brightest gray level?
nurul najmah
on 1 Nov 2015
Edited: nurul najmah
on 1 Nov 2015
Accepted Answer
More Answers (1)
X = imread('grayscaleImage.png');
[R,C] = find(all(X==255,3));
[Y,Z] = unique(C,'first');
imshow(X);
hold on
plot(C(Z),R(Z),'-rx')
produces this:

3 Comments
nurul najmah
on 2 Nov 2015
Stephen23
on 3 Nov 2015
My pleasure. You can also vote for answers that work well.
Chad Greene
on 3 Nov 2015
I voted for your answer Stephen!
Categories
Find more on Image Preview and Device Configuration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!