How to find local minima in a image histogram?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello, I have few search about it in google. but i'm confused :( I would like to search for the first (leftmost) local minimum in the image histogram. For example the attached image is histogram of sample image. and we need local minima. I need just one number. Thanks
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168473/image.jpeg)
0 Kommentare
Antworten (1)
Image Analyst
am 20 Okt. 2017
Bearbeitet: Image Analyst
am 20 Okt. 2017
Use diff() to get the difference between the n+1st bin and the nth bin. Then use find to get the index
[counts, grayLevels] = imhist(grayImage);
index = find(diff(counts) >= 0, 1, 'first');
minGL = grayLevels(index);
5 Kommentare
Walter Roberson
am 20 Okt. 2017
That would not be uncommon. Suppose an image had no true black, then the first histogram entry would be a count of 0. The very first shade that did occur would have a non-zero entry, which is an increase. You would have a local minimum of 0 from the first bin to the first bin that had some data, at which point you would have an increase.
Image Analyst
am 20 Okt. 2017
Bearbeitet: Image Analyst
am 20 Okt. 2017
Yes, that's the first place where the histogram is flat. Perhaps you want findpeaks() where you get more control over how big a peak or valley you detect.
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!