Digit preprocessing

Separation lines for digits

After separating digits explained in a previous posts, I will now elaborate on preprocessing of the digits themselves. In the image on the right you can see an example of a somewhat difficult case, the rightmost digit is turning. This is not a problem for my solution so far. First all digits are cut from the images with help of the separation lines. Then all these digits will be treated separately. First a color histogram is made and a threshold is set to about four fifth of the volume. This means that the darkest portion of all pixels (4/5th) is treated as background and the brightest 1/5th of pixels is treated as foreground. I found this threshold by looking at different data (this seems to be true for both badly and properly captured images).

Thresholded digits

In the image on the left, you can see the separate digits, with their corresponding gray value histograms. The red line denotes the threshold found by selecting 4/5th of the gray value volume.

The digits on the left are the thresholded digits, the digits on the right side of the image are cleared up using techniques called opening and closing. This is used to connect parts of the digits to one large blob and to filter out small noise.

After this is done, large blobs can be selected and smaller ones discarded, thus removing even more noise like the horizontal line below the 2 and the 1, or the digit above the 4 (the dial that is turned halfway). This is not implemented yet, but I will later on. I plan to discard images with blobs that are about the same size, so only images with a single large blob will be recognized (the others are probably images that are turned halfway). Because I have timing information, I can probably guess what the number should be, or in any case calculate some probability for every possible digit. This is something for the next post!

Comments are closed.