Ask Your Question
0

What is the best value for thresholding for bimodal histogram

asked 2018-10-30 02:42:26 -0600

zms gravatar image

Hi all, I have thousands of images with different bimodal histogram as in the picture and trying to do adapative thresholding, just like OTSU but this is not in Grayscale. This is for HSL colourspace, and I'm taking the L value only after separating the channels. I had successfully find the two significant peaks from the histogram as in the picture.

image description

The problem right now, I'm not sure how to get the value for threshold between the bimodal histogram. By taking the average from the two peaks, does not serve the purpose as some of the histogram are not the same size with each other

If anyone has idea to share, I'm glad .

edit retag flag offensive close merge delete

Comments

Why don't you use OTSU ? OTSU methond gives threshold which minimizes intra classe variance

LBerger gravatar imageLBerger ( 2018-10-30 03:32:22 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-10-30 09:51:29 -0600

kbarni gravatar image

You can separate the histogram into 2 gaussians using expectation maximization for a gaussian mixture model. Search Google for examples.

Once you have the parameters of the 2 gaussians, you can compute their intersection point. Use this value as threshold for optimal separation of the two classes.

Another solution would be to use the K-means algorithm with 2 classes; it should estimate automatically the optimal threshold between the two classes. Try both methods to see which one works better in your case.

edit flag offensive delete link more

Comments

Are there other operations on histograms in OpenCV? I have some distributions and all I'm producing so far is maximum value, mean value, and mode value.

sjhalayka gravatar imagesjhalayka ( 2018-10-30 10:52:48 -0600 )edit
1

Well, it depends what do you need.

However as histograms are in fact distributions, probably using statistical analysis (with statistical libraries instead of OpenCV) is a better way.

On the other hand, in image processing you have much more information than grayscale distribution of an image (I'm speaking especially about the spatial distribution of the pixels). So simple image segmentation methods, morphological operators, image derivatives etc. can often give faster and better results than complicated statistical analysis on histograms.

kbarni gravatar imagekbarni ( 2018-10-30 11:56:09 -0600 )edit

Thanks for the information. All my histograms are in this paper: http://vixra.org/pdf/1810.0047vH.pdf -- I just don't know what to do with them.

sjhalayka gravatar imagesjhalayka ( 2018-10-30 15:07:17 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-10-30 02:42:26 -0600

Seen: 1,370 times

Last updated: Oct 30 '18