How to find the neighboring maxima in an image

4 views (last 30 days)
Hi,
I am working on a tool that helps me to find all the maxima in an image. (as shown). The image is a simulated image that I did using MatLab to do. It is similar to the high-resolution transmission electron microscopy to practice this tool in it before applying to real data.
What I want to do is find all the maxima value in the image. For example, I want to select only three-point using
[a,b] = ginput;
let's say these are the value of coordinated position in the image
a =
22.6868
33.0902
23.3238
b =
22.9522
22.7399
13.1858
The next thing I did is using the following command.
gscatter(a,b);
to obatain the follwing
I know that the red points are precisely the point that I select from that image. So here is what I need help with, I want to use only the a and b coordination to determent the other positions in the image.
I did that manually, but this is not going to help because I can't do that in real image.
Any suggections or thought that may help.

Accepted Answer

Image Analyst
Image Analyst on 31 May 2020
Why not simply use imregionalmax()?
  5 Comments
Image Analyst
Image Analyst on 2 Jun 2020
Edited: Image Analyst on 2 Jun 2020
Why are they not scalars???? Of course they are, or else you did not compute them correctly. Why would the number of rows and columns be the same as the number of rows and columns in your image? Also you say you want to minimize user input, yet you say you want to avoid an automatic way to find the bright spots and use ginput() instead. That seems like contradictory requirements to me.
Here is my code for the ginput() method you asked for:
grayImage = imread('eSFRTestImage.jpg');
imshow(grayImage);
g = gcf;
g.WindowState = 'maximized'
uiwait(msgbox('Click 3 points : upper left, upper right, lower left'));
[a, b] = ginput(3)
hold on;
plot(a, b, 'r+', 'MarkerSize', 150, 'LineWidth', 3);
x1 = mean([a(1), a(3)])
x2 = a(2)
y1 = mean([b(1), b(2)])
y2 = b(3)
numColumns = 5;
numRows = 3;
xu = linspace(x1, x2, numColumns);
yu = linspace(y1, y2, numRows);
[x, y] = meshgrid(xu, yu);
% Plot grid
plot(x(:), y(:), 'r.', 'MarkerSize', 150);
I clicked where the red crosshairs are, and then I computed a regularly spaced set of coordinates of 3 rows and 5 columns, which are plotted with the round red spots. Is this not what you want?
Sara
Sara on 4 Jun 2020
Yes that what I want it. Thank you for your comment

Sign in to comment.

More Answers (0)

Categories

Find more on Biomedical Imaging 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!