finding first and second maximum in an image/matrix
显示 更早的评论
Hello,
I have a 360x180 matrix. It has the normalised energy values in dB representing the beam pattern of microphone array in (1:360)° azimuth versus (1:180)° elevation angles.
When I plot it as imagesc(), I have a mainlobe at certain azimuth and elevation surrounded by few sidelobes.
Now I want to find the ratio of maximum sidelobe to the mainlobe. How can I do it?
Please help.
回答(1 个)
Image Analyst
2012-1-28
0 个投票
Since your peaks probably have some width to them you can't simply sort the values and find the greatest. You also probably can't just threshold the image since the separate peaks may have different heights. Therefore I recommend using imregionalmax() in the Image Processing Toolbox. Then you can binarize the image and label it and call regionprops. For each peak you can get the max. (Actually you can get that without even calling regionprops.) But you probably need regionprops to find the centroids of all the peaks so you can determine which blobs are main peaks and which blobs are sidelobes of that main peak (say, the side lobe centroids are within a certain distance of the centroid of the larger main peak). Upload your image to tinypic.com if you need any help. It can get a little tricky if you have multiple clusters of peaks & side lobes and all those have different heights
15 个评论
zozo
2012-1-28
Image Analyst
2012-1-28
Upload a standard image file. It can be your image (that's best) or if you can't do that (use imwrite, that is), you can capture a screenshot and save that and upload the screenshot. Don't upload the fig file itself.
zozo
2012-1-28
zozo
2012-1-28
Image Analyst
2012-1-29
I see a bunch of peaks but I'm not sure which are sidelobes and which are main peaks. Once you identify the value of the main peak, it sounds like you can just divide that number by the image to get the ratio of that to the value of all the other pixels in the image.
zozo
2012-1-29
Image Analyst
2012-1-29
Did you try max(imageArray(:)) ./ imageArray like I suggested? That will give you the ratio everywhere.
zozo
2012-1-29
Image Analyst
2012-1-29
What are you doing first? Isn't the location it's elevation and azimuth, which you say you're doing second? It seems to me that if you find the location you find the elevation and azimuth so they're the same thing, not two separate things.
This would be SO much easier if you had the Image Processing Toolbox. Are you sure you don't want to obtain that? It's really hard to find two dimensional peaks if you can't use imregionalmax. You could maybe try region growing, the CLEAN algorithm, or something else to sequentially remove peaks, but it's harder than a one-liner call to imregionalmax()..
zozo
2012-1-29
Image Analyst
2012-1-29
Call regionprops on P to find the PixelIdxList of each blob. Then find the max intensity of each blob. Then find the max of those blobs (the brightest blob's intensity). Then take the ratios of the dimmer blobs to the brightest blob. That's pretty much it. Let me know if you still need more help.
Image Analyst
2012-1-30
Post your original grayscale image (not the fig file, or the pseudocolored version or a screenshot, but the original image) to tinypic.com, and I'll see what I can do. You can look at my BlobsDemo if you want an example of how to find centroids. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
zozo
2012-1-30
zozo
2012-1-30
zozo
2012-2-1
类别
在 帮助中心 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!