Skip to content

API Reference parrot_pipelines.planogram.perception.ocr

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_pipelines.planogram.perception.ocr

View source

Optional local OCR of shape crops (FEAT-574). RapidOCR is imported lazily; without it, text is read by the LLM.

Class OcrReader

RapidOCR wrapper.

The import is probed at construction and the engine is built lazily on the first read — inside the worker process when called through the CPU executor.

Attributes:

Attribute Type Description
available bool False when rapidocr cannot be imported (the planogram extra is absent).

Method OcrReader.read

Read the text inside a BGR crop. Synchronous and CPU-bound.

read(crop: np.ndarray) -> Tuple[str, float]

Parameter Type Default Description
crop np.ndarray BGR crop in source-image pixels.

Returns: Tuple[str, float] — (text, confidence) — texts joined with " | " and the mean score in [0, 1]; ("", 0.0) when OCR is unavailable, the crop is empty, or nothing is read. Never raises ImportError.

Attribute logger

Function read_crop

Module-level, picklable entry point using a per-process OcrReader singleton.

read_crop(crop: np.ndarray) -> Tuple[str, float]

Parameter Type Default Description
crop np.ndarray BGR crop in source-image pixels.

Returns: Tuple[str, float] — (text, confidence) as returned by :meth:OcrReader.read.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally