Skip to main content
Roberty Studio
IDPBuilder

Pre-processing

Image filters applied to the document before extraction in an IDP template: grayscale, sharpen, brightness/saturation and threshold, with ranges and defaults.

Pre-processing

Pre-processing applies image filters to the document before extraction, to make the text easier for OCR to read. It is a list of filters run top to bottom: each filter receives the image as the previous filter left it.

With no filters, the document goes to extraction as it was sent. Filters are added, reordered, turned off and removed with the layer cards. See Pipeline.

Filters​

FilterWhat it doesSettingRangeDefault
GrayscaleConverts the image to shades of gray.———
SharpenBrings out edges and text detail.Sigma0.3 to 5 (step 0.1)1
M1 — sharpening on flat areas0 to 10 (step 0.5)1
M2 — sharpening on jagged areas0 to 10 (step 0.5)2
Brightness/saturationAdjusts brightness, saturation and hue.Brightness — multiplier0 to 3 (step 0.05)1
Saturation — multiplier0 to 3 (step 0.05)1
Hue — rotation in degrees0 to 3600
Lightness−100 to 1000
ThresholdTurns the image black and white at a cutoff: anything below it becomes black and anything above it becomes white.Cutoff0 to 255128
Apply on grayscale — converts to grayscale before thresholdingOn or offOn

For the multipliers, 1 leaves the image as it is; lower values reduce and higher values increase.

Order of application​

The order of the filters changes the result. For example, with Grayscale → Sharpen → Threshold you remove the color, then bring out the letters and, finally, separate text from background.

Filters only affect the image handed to extraction. Identification compares the incoming document as it arrived, before the filters.

Preview​

To see what the filters do, run the draft in the Playground. The result's Pre-processing stage shows the image after each filter and the final image that goes on to extraction; a filter that is off shows as "image unchanged". See Playground and Simulate API.

When to use each filter​

Document conditionFilters to try
Color photos and scans where color doesn't matter for readingGrayscale
Blurry text or faint outlinesSharpen
Dark, faded or low-contrast imageBrightness/saturation
Stained or shaded background, or marks that get in the way of the textThreshold, adjusting the Cutoff

Filters are not required: clean documents, such as system-generated PDFs, may not need any. Compare the extracted text in the Playground with and without each filter before publishing.