Coordinates of the brightest point of the first line

Hello, how can I know the coordinates of the brightest point of the first line of my image?
Can someone help me with this algorithm?
Thank you,
Thiago Tenório

 Accepted Answer

[minval, minidx] = max(YourImage(:,1));
or
[minval, minidx] = max(YourImage(1,:));
Oh wait -- is this an RGB image or grayscale? If it is RGB then how do you want to define "brightest" ?

6 Comments

Note: Because it's looking at just one row, the (row, column) coordinate is (1, minidx). If you are going to look at brightest points defined in other ways (for a true color image, or for multiple localized (non-global) maxima) or for rows other than the first row, then write back and say so to get solutions for those situations.
And I've been wondering if the "line" is something that needs to be detected in the image, such as a background with things drawn on it, or through edge detection. Then it would be important to define "first"...
Good point. In that situation there are several ways to do it, including taking the max of the masked pixels (works for any shape), or taking the max of a profile that you extract with improfile() (if it's really a straight line).
Thanks for the replies!
It is an image of mammography. I have a black background. The idea is to go through the first line starting with the background image to the edge of mammography. I need coordinate of the point where the image begins, ie where the pixel value is different from the background.
I think a histogram would be a better method for determining the gray level between the foreground and the background.
greythresh() might be suitable.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!