Foreground/Background Options

Foreground/background balance options are the most important. They determine the tradeoff between oversegmentation (putting too much in the foreground) and under-segmentation (putting too much in the background). Their values typically range from 0 (all foreground) to 100 (all background).

 

Pixel-Filter Level

The pix-filter-level parameter defines the balance between foreground and background pixels. A value of 0 indicates that the maximum number of pixels should be placed into the foreground, and a value of 100 indicates that the maximum number of pixels should be placed in the background. A value of 25 is the optimum setting for most 300 dpi documents.

Increase to remove very small shapes from the foreground, smooth out edges, and remove half-toning. Decrease to avoid dropping of characters. This is the most efficient option level to manage the foreground/background tradeoff; always try to tune it first.

Option type

Quality slider

Range

0..100

0

Indicates that the maximum number of pixels should be placed into the foreground

100

Indicates that the maximum number of pixels should be placed in the background

Default

25

Optimization

Default chosen to avoid dropping of characters (it is only acceptable to drop dots). Generally, the optimal pix-filter-level corresponds to the smaller file size, but the optimum varies by document. For most documents it is 50, but it is 25 for 200dpi documents.

Command line

Yes

Expert

The pix-filter-level parameter corresponds to a penalty added each time there is a transition from foreground to background (if two contiguous pixels belong to the same layer, there is no penalty). Reasons why it would decide not to segment foreground are that there are too many such transitions, or that the difference in luminance is not large enough.

Impact on text

A value lower than 25 may improve segmentation of characters whose color is close to that of the background

Impact on photos and images

Higher values avoid small speckles to be segmented

 

Threshold Level

The threshold-level parameter interacts with the pix-filter-level and shape-filter-level options to determine the balance between foreground and background. A threshold level of 50 gives equals room for the foreground and the background to fluctuate around their local average value. In practice a threshold of 75 is preferred, which gives much more room for the background to fluctuate.

It is advisable to decrease the threshold when parts of characters are lost in the background.

Option type

Quality slider

Range

0..100

0

Maximum foreground

100

Maximum background

Default

75

Command line

Yes

Interacts with

pix-filter-level, shape-filter-level

Expert

The threshold-level parameter corresponds to the difference between the foreground and the background standard deviations used by the foreground/background algorithm, as illustrated in the table below. Take for example a pixel whose luminance is between the background average and the foreground average. Its relative luminance is a number between 0 (background) and 100 (foreground). This pixel is classified as foreground only if its relative luminance is larger than its threshold-level. In other words, pixels with luminance<threshold are background, while pixels with luminance>threshold are foreground. As a consequence, high threshold levels favor the background in the transition zones.

 

threshold-level

bg-stdev

fg-stdev

bg-stdev/fg-stdev

comment

0

50

250

0.2

untested

25

100

200

0.5

Poorly scanned documents

50

150

150

1

Manuscripts

75

200

100

2

Default

100

250

50

5

untested

 

Impact on text

Lower values may improve segmentation when characters are very thin. Higher values avoid a noisy background to be segmented with the foreground.

Impact on photos and images

Higher values minimize unwanted segmentation of some parts of the image.

 

Shape-Filter Level

The shape-filter-level parameter specifies the balance between placing ambiguous shapes in the foreground and background layers. An ambiguous shape has both foreground and background layer characteristics. During segmentation, this shape may appear in the inappropriate layer because Document Express must "guess" where to place it. Objects in the foreground have lower color resolution, so ambiguous shapes placed in this layer may stand out unnaturally. (Eyebrows, for example, will appear as if someone drew them in by hand.) Objects in the background have lower overall resolution, so the edges of ambiguous shapes placed in this layer will appear blurry.

Assign the shape-filter-level option a whole number value between 0 and 100. A value of 0 indicates that every ambiguous shape should be placed in the foreground. A value of 100 indicates that every ambiguous shape should be placed in the background.

Determining which ambiguous shapes appear better in the foreground and background layers requires experimentation. If you are unsatisfied with the appearance of an encoded image, encode it again using the shape-filter-level option with different values to find the appropriate balance between foreground and background shapes.

Option type

Quality slider

Range

0..100

0

Maximum foreground (filter is off)

100

Maximum background

Default

50

Optimization

Because of tremendous improvements in the foreback module, thus parameter is no longer so critical. Has not been optimized recently.

Command line

No

Interacts with

 

Expert

Shape (i.e., connected components) with a score higher than this filter level are kept. This score is the difference of two coding costs:

·         Coding cost of everything as a smooth background

·         Coding cost of putting the shape in the foreground: code for the shape and the color separately

This parameter has very little influence over text and drawings. It is mostly useful to minimize the segmentation of photos and images, at very little risk for text. In this case, one should increase it from its default of 50 to something like 75.

In some very rare cases (to segment very small dots), there would be good reasons to decrease this parameter.

Impact on text

Minimal

Impact on photos and images

Higher values improve filtering of speckles

 

Inhibit-Foreback Level

The inhibit-foreback-level parameter corresponds to an a priori cost added to the decision to perform foreground/background separation (vs. deciding that a given block should not be segmented). The segmentation algorithm calculates a "cost" of segmenting a block between foreground and background. If the cost is too high, the block is not segmented; therefore, adding to the cost decreases the likelihood that the block will be segmented.

It is advisable to increase the inhibit-foreback level to remove isolated speckles.

Option type

Quality slider

Range

0..100

0

Maximum text

100

Maximum background

Default

40

Command line

No

Impact on text

Lower values may improve segmentation of very low contrasted text

Impact on photos and images

Lower values may result in undesired segmentation

 

Inversion Level

The inversion-level parameter controls how the Document Express segmenter decides that the text is inverted (white text on a black background). A value of 0 indicates that all text is black on a white background. A value of 100 indicates that all text is white on a black background. The default is 25.

Option type

Quality slider

Range

0..100

0

No inversion

100

All inversion

Default

25

Command line

Yes

Interacts with

Render-size: many of the inversion heuristics rely on render-size when deciding to invert large foreground shapes

Impact on text

Inverted test is the only reason we need this parameter

Impact on drawing

Very hard to control: set inversion-level to 0 if there is no need for inversion

Impact on photos and images

Again, may produce strange artifacts