Appendix A

ALGORITHM FOR DIAGONAL-BOX CHECKER SEARCH

 

The following notation will be used in the algorithm for diagonal-box checker search.

GETPIX(X,Y) The gray level of (X , Y) .

THRESHOLD (z) We define threshold value .

 

Step 1

Set X=0,Y=0.(initial value)

If GETPIX(X,Y) <= THRESHOLD (z),

go to Step 2.

Else go to Step 3.

Step 2

If a=1 or b=1 or c=1 or d=1 or e=1,

set X=X+20, and go to Step 4.

( It may be feature 1 ,feature 5-b ,

feature 6-b , feature 7-b , feature 9- b,

feature 11-b ) .

If b=0 and d=0 , set X=X+20 , and

go to Step 4. (It may be feature 7-a ) .

Otherwise go to Step 5 .

Step 3

If f=1 and k=1, go to Step 5.(It may be

feature 2, feature 3, feature 4-a,

feature 8-a , feature 10-a ) .

Otherwise set X=X+20 and go to Step 4.

(It may be feature 4-b, feature 5-a,

feature 6-a, feature 8-b, feature 9-a,

feature 10-b, feature 11-a) .

 

Step 4

If X>640, set X=0,Y=Y+20 .

If Y>480, terminate the algorithm.

If GETPIX(X,Y) <= THRESHOLD (z),

go to Step 2.

Otherwise go to Step 3.

Step 5

If ( f , g , h , i , j , k , l , m , n ,o ) all be

equal to 1, set X=X+20 and go to Step 4. (It may be feature 2 )

Else store X and Y value, and go to step 6.

Step 6 :

Set length of line y = (x, y) to (x+60, y).

Set length of line y+5 = (x, y+5) to (x+60, y+5).

Set length of line x = (x, y) to (x, y+60).

Set length of line x+5 = (x+5, y) to (x+5, y+60).

Y direction :

When the line labeling 0 is scaned, set its y coordinate minus 5 to y1 variable. The line labeling 0 last encountered, set its y coordinate plus 5 to y2 variable.

 

X direction :

When the line labeling 0 is scaned, set its x coordinate minus 5 to x1 variable. The line labeling 0 last encountered, set its x coordinate plus 5 to x2 variable.

Scan from (x1, y1) to (x2, y2).

Set X=X+20 and go to Step 4.

 

 

index