Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adaptive threshold Binarization's bad effects

I implemented some adaptive binarization methods, they use a small window and at each pixel the threshold value is calculated. There are problems with these methods: If we select the window size too small we will get this effect (I think the reason is because of window size is small) alt text
(source: piccy.info)

At the left upper corner there is an original image, right upper corner - global threshold result. Bottom left - example of dividing image to some parts (but I am talking about analyzing image's pixel small surrounding, for example window of size 10X10). So you can see the result of such algorithms at the bottom right picture, we got a black area, but it must be white. Does anybody know how to improve an algorithm to solve this problem?

like image 416
maximus Avatar asked Feb 17 '10 17:02

maximus


People also ask

What does adaptive threshold do?

Adaptive thresholding is the method where the threshold value is calculated for smaller regions and therefore, there will be different threshold values for different regions. In OpenCV, you can perform Adaptive threshold operation on an image using the method adaptiveThreshold() of the Imgproc class.

Why do we need segmentation by adaptive thresholding?

By applying adaptive thresholding we can threshold local regions of the input image (rather than using a global value of our threshold parameter, T). Doing so dramatically improves our foreground and segmentation results.

What is the use of threshold in image processing?

Thresholding is a type of image segmentation, where we change the pixels of an image to make the image easier to analyze. In thresholding, we convert an image from colour or grayscale into a binary image, i.e., one that is simply black and white.

What is adaptive binarization?

A new method is presented for adaptive document image binarization, where the page is considered as a collection of subcomponents such as text, background and picture. The problems caused by noise, illumination and many source type-related degradations are addressed.


1 Answers

There shpuld be quite a lot of research going on in this area, but unfortunately I have no good links to give.

An idea, which might work but I have not tested, is to try to estimate the lighting variations and then remove that before thresholding (which is a better term than "binarization"). The problem is then moved from adaptive thresholding to finding a good lighting model.

If you know anything about the light sources then you could of course build a model from that.

Otherwise a quick hack that might work is to apply a really heavy low pass filter to your image (blur it) and then use that as your lighting model. Then create a difference image between the original and the blurred version, and threshold that.

EDIT: After quick testing, it appears that my "quick hack" is not really going to work at all. After thinking about it I am not very surprised either :)

I = someImage
Ib = blur(I, 'a lot!')
Idiff = I - Idiff
It = threshold(Idiff, 'some global threshold')

EDIT 2 Got one other idea which could work depending on how your images are generated. Try estimating the lighting model from the first few rows in the image:

  1. Take the first N rows in the image
  2. Create a mean row from the N collected rows. You know have one row as your background model.
  3. For each row in the image subtract the background model row (the mean row).
  4. Threshold the resulting image.

Unfortunately I am at home without any good tools to test this.

like image 159
Hannes Ovrén Avatar answered Sep 24 '22 00:09

Hannes Ovrén