Skip to content

OCR Extract Form Fields

Type: ocr-extract-form  ·  Package: OCR Activities v1.0.0  ·  Output: Dictionary

Extracts text from named rectangular regions of an image. You define, for each field, the zone (box x, y, w, h) where its value is, and the activity performs OCR only in that zone. Ideal for fixed format forms (always the same template), where each data is always in the same place.

For each field in the fields dictionary, it crops the indicated region of the image, OCRs it, and saves the text in the result under that name. Returns a { campo: valor } dictionary.

ParameterEditorDescription
pathexpressionImage file path.
fieldsobjetonombreCampo → { x, y, w, h } Dictionary (region in pixels).
ParameterEditorDescription
languageexpressionLanguage code: eng (def.) · spa · eng+spa.
preprocessexpressionLimpieza previa: none (def.) · auto · deskew · binarize.

Returns a Dictionary with a value for each region defined.

Extract data from a form always with the same design:

OCR Extract Form Fields
path = = rutaFormulario
language = "spa"
fields = {
"nombre": { "x": 120, "y": 80, "w": 300, "h": 30 },
"documento":{ "x": 120, "y": 130, "w": 200, "h": 30 },
"fecha": { "x": 420, "y": 80, "w": 150, "h": 30 }
}
→ output: datos