finding first and second maximum in an image/matrix
Show older comments
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.
Answers (1)
Image Analyst
on 28 Jan 2012
0 votes
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 Comments
zozo
on 28 Jan 2012
Image Analyst
on 28 Jan 2012
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
on 28 Jan 2012
zozo
on 28 Jan 2012
Image Analyst
on 29 Jan 2012
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
on 29 Jan 2012
Image Analyst
on 29 Jan 2012
Did you try max(imageArray(:)) ./ imageArray like I suggested? That will give you the ratio everywhere.
zozo
on 29 Jan 2012
Image Analyst
on 29 Jan 2012
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
on 29 Jan 2012
Image Analyst
on 29 Jan 2012
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
on 30 Jan 2012
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
on 30 Jan 2012
zozo
on 30 Jan 2012
zozo
on 1 Feb 2012
Categories
Find more on Descriptive Statistics 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!