DILATE4 filter

The DILATE4 filter is a standard binary filter which works in a 3x3 environment.

The DILATE4 filter assigns a 1 to the center pixel if one or more horizontal or vertical neighbours are true as well; else a 0 is assigned.

The result of using DILATE4 is that true pixels 'grow' in horizontal and vertical direction.

  

Input:

Output:

Example 1:

When of 9 input pixels considered, all pixels in the lower row are true, and all others false (position 2 is a vertical true neighbour):

  

0

0

0

0

0

0

1

1

1

The DILATE4 filter puts these pixel values in a special order or bit position as below (where 0 means last position, 1 one but last position, etc.):

  

5

6

7

4

8

0

3

2

1

The ordering results in the following binary number : 000001110

(This equals: 21 + 22 + 23 = 2 + 4 + 8 = 14)

This number is looked up in a table which is present in the binary filter itself:

0-63=0101111101011111111111111111111101011111010111111111111111111111
.........

The value assigned to the center pixel is 1.

Example 2:

When only the lower left and lower right pixel are true (no horizontal or vertical true neighbours), like:

  

0

0

0

0

0

0

1

0

1

  

the filter creates binary number: 000001010

(decimal: 21 + 23 = 2 + 8 = 10)

When answer 10 is looked up in the table; the output value is 0:

0-63=0101111101011111111111111111111101011111010111111111111111111111
........

See also: