Computer Science 766 Term Project.

 

12/2002

Ke Sheng

 

Optical Character Recognition (OCR) Based on OCRchie

 

Abstract: An algorithm based on OCRchie is reviewed and implemented to recognize scanned in files. The algorithm is carefully analyzed step by step. A few difficult situations are separated out to give special solutions. OCRchie is robust for scanned in files because of the invariant OCR vector for scaling and translation. However, this method does not apply to projective or affine transform because the invariance no long holds for such condition.

 

Introduction:

 

OCR converts image files content word information into pure text files. The advantages of text files are obvious: First, text files require much less space in storage. Second, text files are editable, indexable and searchable. It is a lot easier to organize and achieve text files than image files of text. An automatic method based on computer recognition, namely OCR, is then developed.  

 

Optical character recognition is well established and has been applied to many areas for long time. The newest commercial available software can recognize hands writing easily. However, the research on the basic algorithms of the OCR is still very interesting in the learning of computer vision.

 

In this project, one of the OCR methods is reviewed and implemented in simple cases. Its advantages and limitations are discussed. Some solution for difficult situation is given.

 

 

Methods and materials:

 

The method is based on OCRchie (K. Marsden). There are 4 steps associate with the recognition process.

 

1. Character learning

Figure 1: a sample of character recognition database

 

 

An image of characters that have the same font as the to be recognized text is input and saved into individual matrix.

 

2. Character extraction.

 

This is the most important step in OCRchie. A correct and precise extraction will ensure good recognition, vise versa.

 

When a page of text is scanned in, the first thing to do is defining the lines. A statistic method is used in this step. Randomly draw lines through the image. The direction of least broken by characters is the right direction of lines. A preprocessing of noise suppression is necessary to avoid false detection of characters.

 

Figure 2: a sample of scanned in image.

 

When the line of the text is determined, image is first partitioned into a number of lines. Lines the are broken into characters by vertical projection, which is a projection the same line into a one dimensional space to find a raw segmentation in the same line.

Figure 3: Raw partitioned text image

However, when the projection of two disconnected characters is overlapped (fig.4), a more subtle segmentation is required.

 

Figure 4: characters have overlapped projection

 

Row scanning method is used to solve this problem.

 

Figure 5: an illustration of the row scanning technique. Adapted from Cs766 class note.

 

 

The result of row scanning figure 4 is figure 6.

 

Figure 6: the result of row scanning segmentation.

 

Then any disconnected part of input image is segmented.

 

3. Property extraction.

 

After the individual characters is isolated, they are equally divided into 5X5=25 partition. 

 

Figure 7:There are 29 properties associating with the 25 sub region.

There are 29 properties associating with the 25 sub region:

The first 25 elements are the ratio of black: white (grayscale) in each of 25 equal-sized sub regions of the character.
Property 26 is the grayscale across the top 1/2 division.
Property 27 is the grayscale across the bottom 1/2 division.
Property 28 is the width/height ratio again scaled to (0-255)
Property 29 is Indicator of a vertically disjoint character like j and i.

 

These 29 properties compose an OCR vector.

 

The number of properties can be adjusted to accommodate the number of sub regions.

 

4. Properties comparison:

 

 

The confidence function of detected characters and database is expressed as:

 


 

 


To speed up the comparison, the last four properties are used to divide the characters into a few sub groups based on their major difference. For example, “l” and “t” in the group of the tall characters, “o” and “a” in the group of short characters because their difference in property 28.

 

OCR result of sample image (figure 2) is:

 

“Image reconstruction from a limited number of projections is a well-investigated subject in tomographic reconstruction fields. For example, this problem possesses applications in visualization of three-dimensional (3D) blood vessel structure from angiographic projections and cardiac imaging with various modalities (Saint-Felix et a/ 1994). In spite of a lot of work, however, it is fair to say that successful reconstruction algorithms which can be used in clinical routine do not exist. This paper proposes an iterative reconstruction algorithm which is powerful for sparse objects. Here, the sparse objects refer to objects which have non-zero pixel values only on a relatively small number of pixels. Such objects appear in many instances of tomographic imaging. In particular, we have the following three applications in mind. The first”

 

Although there is no false recognition in this short test, this is partly because of the very good quality of the input image. When the input image is poor, low confidence in recognition is an often happening and results in mis-recognition.

 

Despite all those randomly errors, there are a few common situation where OCR meet difficulties.

 

The first one is that the characters in a sequence stick together and form something not in the database.  Characters most prompt appear in this situation are r and f as shown in figure 8.

 

Figure 8: The stick together characters

 

Before better solution is devised, a method partly based on guess is used. These multiple characters are broken into smaller part from a sudden thinner part of the figure as shown by the arrows.  Then compare the sub-divided part with existing database. If there is a better match, then accept it. If worse then reject the subdivision and keep this as unrecognizable.

 

Another common cause of mis-recognition is broken characters, which is a usual situation in repeatedly copied materials. An “r” is often OCRed to be an “l” and something small and unrecognizable. One solution of this problem is including the unrecognized part with preceding character to improve the confidence.

 

Figure 9: A broken “r”

 

There are still many exceptions to any general solution. Therefore, an interactive algorithm might be necessary to decrease the chance of false recognition.

 

 

 

Conclusions:

 

The OCRchie algorithm is robust in the situation of translation and scaling. A zoom in or zoom out obviously does not change the ratio of black to white for certain characters. 

 

Figure 10: Invariant under scaling transform

 

 However, the OCRchie 29-vector is not invariant to affine or projection transform.

 

 

Figure11: OCRchie vector is no longer invariant under rotation

 

Therefore, to recognize characters from arbitrary sources like photo and movie, other recognition method than OCRchie is necessary. For example, the five point invariant under projection or image canonization. However, they are beyond the scope of this project.

 

 

 

Reference: K. Marsden