# How to find the neighboring maxima in an image

4 Ansichten (letzte 30 Tage)
Sara am 29 Mai 2020
Kommentiert: Sara am 4 Jun. 2020
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.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Image Analyst am 31 Mai 2020
Why not simply use imregionalmax()?
##### 5 Kommentare3 ältere Kommentare anzeigen3 ältere Kommentare ausblenden
Image Analyst am 2 Jun. 2020
Bearbeitet: Image Analyst am 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:
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 am 4 Jun. 2020
Yes that what I want it. Thank you for your comment

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Biomedical Imaging finden Sie in Help Center und File Exchange

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by