Size Options

The options described below are exposed only at the SDK level. These size parameters mostly depend on resolution and scanning conditions (generally DPI/100; for instance, 300 dpi means render size=3). The reasons for setting them to different values are uncommon:

edge-size – can be reduced when both the printing and scanning qualities are excellent and you want a high quality 300dpi background up to the edges of the characters

render-size – could be smaller than the others when very small fonts are used in a 300dpi document

 

Edge Size

Defines the thickness (in pixels) of character edges where color may be unreliable due to the following:

Dithering in the printing process

Bad color registration in the printer or the scanner

Ink blurring around in old documents

Its most direct influence is a band of pixels around each character, within which Document Express does not sample the background color. It does not impact the character thickness itself.

Option type

Pixel size

Range

1..3

1

Indicates the image is very clean and/or was scanned at 100 dpi

3

Ancient or poorly printed documents where the foreground color blurs over the background in a visible way. Poorly scanned documents.      

Default

2

Command line

No

Expert

This option affects the way the morphological analysis is performed. The following factors are set to edge-size:

Dilation factor

This corresponds to a dilation of the foreground, but more significantly to an erosion of the background. Along all edges, a band of dilation-factor thick background pixels is assumed to suffer from aliasing, and thus unusable to sample the background color.

Erosion factor

This corresponds to an erosion of the foreground. Along all edges, a band of erosion-factor thick foreground pixels is assumed to suffer from aliasing, and thus unusable to sample the foreground color. Note that a shape is never completely eroded.

Note that along each edge there is a “no man's land” band, were the pixel color is deemed unreliable, and which is dilation-factor+erosion-factor thick!

Impact on text

Very small

Impact on background behind text

Will not vary at the edges of characters

 

Render Size

Size of the "ideal" pixel, viewed at the standard rendering resolution. For instance, when viewing a 300dpi image on a standard computer string, one screen pixel corresponds to 3x3 image pixels.

This quantity is critical to determine when every small shape should be included in the background, through various heuristics.

Its most direct influence is that any character with render-size or fewer pixels will be removed

Option type

Pixel size

Range

1..6

0

Very clean or 100dpi images

4

High resolution images

Default

3

Command line

No

Interacts with

Inversion level: many of the inversion heuristics rely on this parameter when deciding to invert large foreground shapes.

Expert

The initial motivation behind render-size is that characters displayed on the screen have a reasonable size (typically more than 10 pixels and less than 100 pixels).

The following quantities increase linearly with render-size:

·         min-pix-per-cc – Minimum number of pixels per connected component.

·         shape-weight – Weight applied to the cost of encoding each connected component shape

·         filter-level – Connected components with a score lower than this filter level are kept

·         min-pix-per-cc-to-invert – Connected components with fewer pixels than that cannot be inverted

·         max-pix-per-invert-cc – Connected components with more pixels than that cannot be inverted

Impact on text

Very small

Impact on drawings

Noticeable but quite unpredictable

 

Blurring Size

Defines the size (in pixel) of blurring convolutions applied in the segmenter. Generally very similar to edge size, handling similar problems:

dithering in the printing process

noise in old documents

Option type

Pixel size

Range

1..3

1

Very clean or 100dpi images. There is no blurring and it is assumed that there is no color dithering and half-toning at all, that the scanning quality is very good, and the document is very clean

2

Low resolution or clean images: applies a 2x2 convolution before computing the histograms

3

Standard and high resolution images: applies a 3x3 convolution before computing the histograms

Default

3

Command line

No

Impact on text

Larger values help when the background varies because of half-toning

Impact on text

Very small

Impact on background behind text

Will not vary at the edges of characters

Impact on drawing

Larger values may be useful for wood-prints

Impact on photos and images

With poor quality scans, larger values may prevent undesired segmentation

 

Block Size

Width and height, in pixels, of the block used for local foreground/background thresholding. The possibility of having overlapping block allows to extend the size of the blocks to block-size*block-overlap. These much larger blocks are used to compute much finer estimates of the foreground and background intensity levels and cover an entire shape. The small blocks are still used for the final thresholding, and the high density of boundaries between small blocks allows a block boundary to fall on a sharp change in the foreground color.

Block-size has to be reduced when artifacts due to fast changing foreground colors are observed (for instance, characters of different colors that happen to be next to each other). If this is not computationally too expensive, block-overlap should be increased accordingly.

Option type

Pixel size

Range

4..32

4

Minimum value to be able to measure a significant threshold, provided that block-overlap>2

32

Maximum recommended value: beyond that, problems may occur in capturing fast changing foreground colors

Default

16

Optimization

16 was chosen as a good compromise between speed and quality

Command line

No

Interacts with

Block-overlap

Expert

Users may define smaller values when lines of different colors are very close (and characters are small)

In general, a smaller value will adversely affect performance (speed, memory, quality)

Impact on text

Lower value may result in the dropping of some small fragments of characters such as the dot over an “i”. Larger values are problematic when characters of different colors are next to each other.

 

Block Overlap

Number of overlapping blocks. Horizontal overlapping occurs in the following way (vertical overlapping behaves in the same fashion):

block-overlap=1, block-size=4

1111

    2222

            3333

 

block-overlap=2, block-size=4

11111111

    22222222

            333333333

 

block-overlap=3, block-size=4

111111111111

    222222222222

            333333333333

Overlapping gives more choice for block boundaries, avoiding the need to cut characters.

Option type

Number

Range

0-2

0

Corresponds to no overlap. It results of blocking artifacts, as there is no choice on where to place the boundary.

2

Avoid blocking artifacts, in particular more robust when segmenting drawings. However, segmentation is much slower.

Default

1

Optimization

1 was chosen as a good compromise between speed and quality

Command line

No

Interacts with

Block-size

 

Thickening

Thickening (in pixels) applied to characters.

The option is different from edge-size, as it performs an actual thickening of the character, typically by one pixel.

Note that:

Most users have reported an improved readability with thickening=1.