Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm thresholding an image where the threshold value is a count of the pixels such that for instance if the threshold value is 100, any color value which has less than a 100 pixels is classified black and any color value which has greater than 100 pixels is classified as white. Right now, I'm using a manual method of specifying a threshold value. Are there any options that I can use for automatically finding the threshold in this case ?

share|improve this question
I can't think of anything generic, cause it's a non-standard binarization approach. But, if you list some expected properties of your images (e.g. how much object area vs background area is expected, level of details in your image ...) and/or offer some example images (and results), we can try to help – penelope Jan 10 '13 at 8:01

The book Digital Image Processing by Gonzalez and Woods provides a good introduction into standard techniques for automatic binarization. The Otsu technique is a popular one, and it's good practice to implement it on your own at least once.

But above all: give it a try! Look at a histogram of grayscale values in your image and then ask yourself whether the distribution of grayscale values immediately suggests a technique. Even if you're not sure how to work with the histogram, you might have an idea of the solution that you'd like to implement.

It's not easy to learn image processing just from online sources in bits and pieces. If you plan to work in image processing, and if you can afford it, try to have your own copy of at least one image processing book for reference. The Gonzalez and Woods textbook is a good standard reference, and is used in a number of undergraduate courses.

You can use the OpenCV library, buy the O'Reilly book, read forum posts and questions about OpenCV, etc., but in my opinion the Gonzalez and Woods book will ease you into the subject more gracefully.

As always, if you are trying to solve a problem related to a specific image, please post the image. People who work in image processing for a living can often tell you a lot based just on an image; otherwise it can be difficult to provide more specific advice than just "read this chapter." A binarization technique that works well for one set of images can perform poorly for another set of images.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.