Image binarization (2) : Art or science?

Image binarization is intrinsically linked to the image histogram, that 1D representation of the distribution of greys within an image. There are many forms of histogram, as outlined in a previous post. The trick is turning a grayscale image into a binary image without loosing key information, and to that end binarization is somewhat of an art. Why you ask? Shouldn’t it be a science? If you are processing images that are all very much alike, some experimentation will provide a means of thresholding the images so you get very similar results in all cases. For example, consider a factory that makes building toys that uses an image verification system to check that parts are accurate. All parts are photographed using consistent lighting, and there is sufficient contrast between objects and background to make the task easy and reproducible. Consider the image of the gear below (with suboptimal lighting as it is just an illustration). The task may be to determine that none of the gear’s teeth are defective.


The histogram of this image looks like this:


Which represents a bimodal distribution: one mode represents the gear, the other the background region in the image. This is an ideal scenario. Now a threshold can be selected somewhere in the “valley” between the two peaks. Naturally this image is not completely perfect, as a machine vision system would have optimal lighting which would illuminate the object in a uniform manner. If we binaries the image using Otsu’s algorithm, we get a threshold value of 108.


The algorithm produces a binary image which shows the teeth quite nicely, however the inner portion of the gear has one side, and two of the holes missing. This is not such a problem is we only care about the gears teeth. Would another algorithm do a better job?


Here are the results from applying 16 different binarization algorithms (courtesy of ImageJ):


As you can see from the results, none of them is perfect. Many extract the teeth, but not the inner holes, others extract the inner holes at the expense of some of the teeth. It’s not a perfect system.

Now imagine trying to create a generic thresholding algorithm? Difficult? Yes, highly. So binarization becomes an art because you often have to use a creative approach to finding the appropriate algorithm to perform the thresholding – and in some cases it might be too complex an image for any algorithm to produce results.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s