How to find highest three peaks in histogram?
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I found histogram of an image.I want to find highest three peaks of the histogram and find its location to feed as input.How to do it using for loop?
2 Kommentare
Gentian Zavalani
am 6 Okt. 2016
Return data from hist function to a variable (y = hist(x,bin);) and use Peakfinder FileExchange submission to find local maximums.
Guillaume
am 6 Okt. 2016
We're talking about histogram (of an image so imhist is better than the very outdated hist), so peakfinder (or findpeaks) are not appropriate as they find local maxima. I assume Escalin just want the location of the highest three values in the histogram (which may well be next to each other)
Antworten (2)
Guillaume
am 6 Okt. 2016
[counts, binlocation] = imhist(yourimage); %plus whatever option you used for imhist
[sortedcount, indices] = sort(count); %sort your histogram
peakvalues = sortedcount(1:3) %highest 3 count in the histogram
peaklocations = binlocation(indices(1:3)) %respective image intensities for these peaks
3 Kommentare
Guillaume
am 8 Okt. 2016
Absolutely Not! findpeaks is completely inappropriate for finding the highest three values of an histogram.
Image Analyst
am 8 Okt. 2016
Bearbeitet: Image Analyst
am 8 Okt. 2016
That's why I asked him, in his duplicate question, to explain what he defines as peaks, since there is some ambiguity and different people can define peaks in different ways, like the 3 highest bins, or the bins at the centers of the three tallest "humps" in the histogram. We need to know which way he wants it.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!