OCR Get Lines
OCR Get Lines
Section titled “OCR Get Lines”Type: ocr-get-lines · Package: OCR Activities v1.2.5 · Output: List<object>
Recognizes the text of an image and returns a structured list of lines, each with its words and the coordinates (bounding box) of every element. It is the “detailed” version of OCR: instead of a block of text, it gives you the position of each line and word, useful for layout analysis or to locate data spatially.
How it works
Section titled “How it works”Runs OCR on the image and returns the detected lines, in the engine’s reading order, with their words and coordinates. For most cases OCR Recognize File (plain text) is enough; use Get Lines when position matters. This activity has no preprocessing.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | — | Path to the image file (.png, .jpg, .bmp, .tiff). |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
language | string | "eng" | Text language: Tesseract code (eng, spa, eng+spa) or regional tag (es-CO, en-US). See language. |
Output
Section titled “Output”Returns a List of lines. Each line is a dictionary:
| Key | Type | Content |
|---|---|---|
text | string | Line text (its words separated by one space). |
x, y | number | Top-left corner of the line (px). |
width, height | number | Size of the line (px). |
words | List | The words of the line; each with text, x, y, width, height. |
Coordinates are image pixels, with the origin at its top-left corner. If the image has no readable text, the list is empty.
Example
Section titled “Example”Find the line that contains the total:
OCR Get Lines path = imagePath language = "spa" → output: linesLog message = "Lines detected: " + count(lines)For Each items = lines itemVariable = line └─ activities: If condition = startsWith(str(line["text"]), "Total") └─ then: Log message = "Total at y=" + line["y"] + ": " + line["text"]Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
File not found. | The path does not exist on the robot’s machine. |
'path' is required. | path is missing. |
Tesseract language '…' not found at '…'. Available: [eng, spa]. | The language code is not installed. |
Related activities
Section titled “Related activities”- OCR Recognize File — plain text (no coordinates).
- OCR Extract Table — detect a table from the positions.
- OCR Find Text — locate a specific text.