Detecting Registration Marks

When a user scans a form, perturbations or transformations are added to the image such as rotation, zooming, reduction, and translation (shifting in position). These effects make it difficult to identify the different parts of the form, complicating the detection and recognition phases.

Registration marks can be used to help identify and localize the different parts of the form. Registration marks are predefined shapes that are added to the original form in specific locations. These marks can then be used to identify the transformations or deformation added to the original form, and then to correct a scanned form’s orientation and resize it to its original size.

Currently, there is only one type of registration mark that has been defined for use with scanned forms (more are to be added later). The valid registration mark is a T-shaped figure as shown in the following figure. It is a "T" rotated by 90 degrees counter clockwise. The P4 point must be on the center point of Line P1P2 (that is, the distance from P1 to P4 equals the distance from P2 to P4). The line width should be greater than 2 pixels(preferably 3 pixels). There are no conditions on line lengths since you provide the values for lWidth, lHeight, lMaxScale, and lMinScale. Use the IsRegistrationMark method to ensure the selected mark is a valid registration mark.

 

image\T_Shape_Fig.gif

 

Currently, to be used with the registration marks methods a document image must consist of white objects on a black background.

To use the registration methods, begin with creating the reference document that contains the registration marks in the exact positions on the form that will be used for scanning. The registration marks should be placed in different areas of the form far enough apart on the form that good triangulation can be performed – but not where they would not always appear on the form in their entirety when the form is scanned. The registration methods are designed to use three designated registration marks as reference points. A sample reference form (reduced in size) is shown in the following figure:

 

image\ReferenceForm.gif

 

After creating the reference document, scan it to obtain a document image. The reference document must be scanned in perfectly: any documents using the reference document for registration will be transformed to match its size, shifting, and rotation exactly.

The registration methods work by finding the (X, Y) positions of three labeled points and comparing them with the positions of these points on the scanned image. With that information it is possible to determine the shifting, rotation and scaling of the scanned image (6 equations with 5 unknowns). The unknowns are:

Shifting along the X-axis

Shifting along the Y-axis

Scaling on the X-axis

Scaling on the Y-axis

Rotation angle.

On the example form, registration marks have been placed in five locations on the form. Three of these marks are to be selected and the other two ignored (the registration functions use the three locations on the form in order to solve the equations). Select three registration marks.

For each registration mark, designate the searching area for that mark, and specify the maximum allowable shift, rotation and scaling. Each searching area should contain only one registration mark and it is preferable that the mark be located in an otherwise blank portion of the form. This information is designated using the following properties:

Type property

RGS_T

Width property

Registration mark’s width, in pixels.

Height property

Registration mark’s height, in pixels.

MinScale property

Minimum registration mark percentage scaling to be detected.(for example, 90,85, or 75 …etc)

MaxScale property

Maximum registration mark percentage scaling to be detected. (for example, 110,120, or 125 …etc)

Top property

specify the Top of the area to be searched for registration marks (in pixels).

Left property

specify the Left of the area to be searched for registration marks (in pixels).

Bottom property

specify the Bottom of the area to be searched for registration marks (in pixels).

Right property

specify the right of the area to be searched for registration marks (in pixels).

NumberOfExpectedMarks property

Number of expected registration marks inside the search area. Set this to 1. (Since there must be one registration mark inside each area.)

DetectectedMarkCount property

specify the number of detected registration marks inside the search area.

DetectedMarkPointX property

determine X coordinate location of the detected registration marks.

DetectedMarkPointY property

determine Y coordinate location of the detected registration marks.

 

With this property you can use the GetMarksCenterMass method to compute the center of mass for each of these marks.

Now you can scan forms and correct their orientation and size. The figure below shows a sample scanned form (reduced in size) with noticeable skew:

image\ScannedForm.gif

The next step is to search for the registration marks in the scanned image. Use the SearchRegMarks method on the scanned image to find the registration marks. If all of the registration marks were detected then use the GetMarksCenterMass method to compute the center of mass for each registration mark.

The next step is to determine the shifting, scaling and rotation necessary to re-orient the scanned image. To do this, Fill the ReferencePointsX and ReferencePointsY properties as well as the TransformedPointsX and TransformedPointsY before calling the GetTransformationParameters method.

To re-orient and resize the scanned image so it is like the reference image, use the values in the XTranslation, YTranslation, TransformationAngle, Xscale and Yscale properties in the ApplyTransformationParameters method. This is equivalent to shifting the image using CombineExt, rotating the image using Rotate, and scaling the image using Size.(Note: It is important to do the operations in this order. You will get an incorrect result if you change the order.) The following figure (reduced in size) shows the scanned form after it has been re-oriented and re-sized:

image\TransformedFormScreenShot.gif