MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

# How to get the value fo the two peaks of a histogram

Asked by Twilighter on 19 Jul 2012

How to get the value of the two peaks of a histogram

I have a program which do some calculations on an image by getting the membership value of pixels using fuzzy logic

the program is calculating this between (what it said ) the two peaks after getting the Image histogram

and for the cameraman Image it concidered the two peaks are 20 & 160 from the look at the histogram it seems that it's the value of the two obvious peaks there

what i need to know is how to get the two peaks using matlab ??

the two peaks of a Histogram ? if my interpretation is correct

## Products

No products are associated with this question.

Answer by Image Analyst on 19 Jul 2012

Look here http://fiji.sc/wiki/index.php/Auto_Threshold for a wide variety of autothresholding methods. There is no one single method that will be best for any and all types of histograms, that's why there are so many. Pick the one that works best for your types of images.

Twilighter on 21 Jul 2012

Image Analyst thank you for keeping up with me ... but the main point here what is the value of "p" ?? this is got through the two peaks, what i understood is that it concider that from the min: p is the background and from : max is the foreground

counting between the two peaks 20:160 how to get those two values from an image??? this is still not answered, this is just what i want, hoe to get the two peaks of any image to be able to run this program, if we want this for the popular "lena" image for example?

Image Analyst on 21 Jul 2012

Well when I referred you to a bunch of auto threshold routines that you could try (to pick a value of p automatically), you acted like I didn't understand you because I was directing you to autothresholding methods when you really wanted the location of the peaks. So I gave you code to find the peaks, assuming you already had a thresholding method. So now I've given you both, but I'm still not sure why neither of those meets your needs.

Twilighter on 1 Aug 2012

Maybe my lack of knowledge to some concepts, I thank you Image Analyst & I'm testing the solutions you gave to me