How to find the neighboring maxima in an image
2 次查看(过去 30 天)
显示 更早的评论
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/305563/image.png)
The next thing I did is using the following command.
gscatter(a,b);
to obatain the follwing
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/305567/image.png)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/305571/image.png)
Any suggections or thought that may help.
0 个评论
采纳的回答
Image Analyst
2020-5-31
Why not simply use imregionalmax()?
5 个评论
Image Analyst
2020-6-2
编辑:Image Analyst
2020-6-2
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);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/308103/image.png)
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?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Biomedical Imaging 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!