> For the complete documentation index, see [llms.txt](https://docs.augelab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.augelab.com/function-blocks/blocks-reference/ai-blocks/ocr.md).

# OCR

This function block extracts text from images and returns recognized text, bounding boxes, and an optional annotated image. It is designed for simple drag-and-drop pipelines: feed an image, set confidence threshold and options, then consume the text or visualize results.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

`Image` This input accepts any image you want to perform text recognition on.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Result` Annotated image with detection boxes and optional text overlay.

`Whole Text` All detected text joined as a single string.

`Texts` Individual detected text strings (multiple outputs possible).

`Boxes` Detected bounding boxes for each text region.

## 🕹️ Controls <a href="#controls" id="controls"></a>

`Use auto rotation` Toggle to enable automatic rotation handling for upside-down / rotated text.

`Show Texts` Toggle to draw recognized text labels on the annotated output image.

`Threshold` Slider to set minimum confidence for accepted detections (higher = fewer, more confident results).

## 🎨 Features <a href="#features" id="features"></a>

* Real-time text detection and recognition from images provided to the `Image` input.
* Confidence filtering using the `Threshold` slider to ignore weak detections.
* Optional image annotation: draw boxes and text on the returned `Result` image when `Show Texts` is enabled.
* Auto-rotation support to improve recognition on rotated or upside-down text when `Use auto rotation` is enabled.
* Outputs are provided in both human-readable string form (`Whole Text` / `Texts`) and structured geometry form (`Boxes`) for downstream processing.

## ⚙️ Running mechanism <a href="#running-mechanism" id="running-mechanism"></a>

* Provide an image to the `Image` input and run the scenario.
* The block processes the image and filters detections below the chosen `Threshold`.
* If any outputs that require visualization are connected, the block returns an annotated `Result` image with boxes and optional text overlays.
* Text outputs (`Whole Text`, `Texts`) and geometry outputs (`Boxes`) are produced for use by other blocks or export tools.
* Note: the first run may take longer (model or resources are initialized on demand). Afterwards, inference runs faster.

## 📝 Usage instructions <a href="#usage" id="usage"></a>

1. Feed the image you want to read into the `Image` input.
2. Set the `Threshold` slider to filter out low-confidence recognitions. Start with moderate values (e.g., 30–50) and adjust.
3. Enable `Use auto rotation` if your images may contain rotated text.
4. Enable `Show Texts` if you want the returned `Result` image to show detected text labels.
5. Use the `Whole Text`, `Texts` or `Boxes` outputs as needed (for display, logging, or logic).

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* Improve accuracy by cropping the area that contains text first with `Image ROI Select` so the block only processes the region of interest.
* Speed up inference on large images by using `Image Resize` before feeding the image into this block.
* Remove complex backgrounds or isolate text regions with `Background Removal (RMBG-1.4)` or `Background Removal (BiRefNet)` when text sits on cluttered backgrounds.
* Reduce visual noise with `Blur` or convert to a cleaner binary image with `Image Threshold` when working with noisy captures.
* Quickly preview OCR results by sending the annotated `Result` image to `Show Image`.
* If you want an alternative OCR approach, try the `OCR (EasyOCR)` block and compare results for your dataset.
* Save recognized text or images downstream with `Image Logger`, `Image Write`, or `CSV Export` for traceability.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* No text detected: increase the input image quality (crop to text, increase resolution) or lower the `Threshold` slightly.
* Many false detections: raise the `Threshold` and crop the image to focus on real text regions.
* Rotated text not read correctly: enable `Use auto rotation` or pre-rotate the image with `Image AutoRotator` or an `Image Resize` + rotate step.
* Slow initial run: the first evaluation may take longer while resources initialize. Subsequent runs will be faster.
* If you only need bounding geometry for logic (not annotated images), disconnect visualization outputs to reduce processing overhead.
