find threshold in histogram

5 次查看(过去 30 天)
pasta pontikaki
pasta pontikaki 2019-3-21
回答: Abhishek 2025-3-14
I have a structure the reuslt of hough table, with 1200 values like theta, rho etc.
I made a projection in theta values to show the distribution of the theta.
So i puted on X-axis the agle range from -90:90 and ploted in histogram. I was expecting to see two gaussian curves with negative and possitive theta.
The result is this:
I want to find the threshold between the two curves, i suppose its near -10
I tried Otsu threshold with graythresh function, but it gives a normalized value equals to 0,453, because otsu gives result in [0,1] range.
I wanted to try the the function normalize but my matlab is old.
Any idea how to find the threshold?

回答(1 个)

Abhishek
Abhishek 2025-3-14
Hi,
I understand that you want to determine the threshold between the two Gaussian curves from the histogram distribution.
Since the “graythresh” function provides a normalized value and using “normalize” function isn’t possible, here is an alternative approach that can be used:
  1. Use the “fitgmdist” function to fit a Gaussian Mixture Model (GMM) to identify the parameters of the two Gaussian distributions.
  2. Extract the means, standard deviations and weights of the Gaussian components from the fitted GMM.
  3. Use the “normpdf” function to calculate the probability density function for each Gaussian distribution based on the extracted parameters.
  4. Determine the intersection point where the two Gaussian PDFs are equal using the “fzero” function, starting with an initial guess such as the average of the means of the distribution.
To know more in detail on how to use these functions, refer to the MATLAB documentation listed below:
Since, the above functions are available in older releases of MATLAB as well, I hope this approach helps achieve the desired goal.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by