OCR Extract Form Fields
OCR Extract Form Fields
Section titled “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.
How it works
Section titled “How it works”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.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
path | expression | Image file path. |
fields | objeto | nombreCampo → { x, y, w, h } Dictionary (region in pixels). |
Optional parameters
Section titled “Optional parameters”| Parameter | Editor | Description |
|---|---|---|
language | expression | Language code: eng (def.) · spa · eng+spa. |
preprocess | expression | Limpieza previa: none (def.) · auto · deskew · binarize. |
Output
Section titled “Output”Returns a Dictionary with a value for each region defined.
Example
Section titled “Example”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: datosRelated activities
Section titled “Related activities”- OCR Extract Pattern — extract by regex pattern.
- OCR Recognize Screen Region — read a single region.