Stitch OCR Detections¶
Class: StitchOCRDetectionsBlockV1
Combines OCR detection results into a coherent text string by organizing detections spatially. This transformation is perfect for turning individual OCR results into structured, readable text!
How It Works¶
This transformation reconstructs the original text from OCR detection results by:
-
📐 Grouping text detections into rows based on their vertical (
y) positions -
📏 Sorting detections within each row by horizontal (
x) position -
📜 Concatenating the text in reading order (left-to-right, top-to-bottom)
Parameters¶
-
tolerance: Controls how close detections need to be vertically to be considered part of the same line of text. A higher tolerance will group detections that are further apart vertically. -
reading_direction: Determines the order in which text is read. Available options:-
"left_to_right": Standard left-to-right reading (e.g., English) ➡️
-
"right_to_left": Right-to-left reading (e.g., Arabic) ⬅️
-
"vertical_top_to_bottom": Vertical reading from top to bottom ⬇️
-
"vertical_bottom_to_top": Vertical reading from bottom to top ⬆️
-
"auto": Automatically detects the reading direction based on the spatial arrangement of text elements.
-
Why Use This Transformation?¶
This is especially useful for:
-
📖 Converting individual character/word detections into a readable text block
-
📝 Reconstructing multi-line text from OCR results
-
🔀 Maintaining proper reading order for detected text elements
-
🌏 Supporting different writing systems and text orientations
Example Usage¶
Use this transformation after an OCR model that outputs individual words or characters, so you can reconstruct the original text layout in its intended format.
Type identifier¶
Use the following identifier in step "type" field: roboflow_core/stitch_ocr_detections@v1to add the block as
as step in your workflow.
Properties¶
| Name | Type | Description | Refs |
|---|---|---|---|
name |
str |
Enter a unique identifier for this step.. | ❌ |
reading_direction |
str |
The direction of the text in the image.. | ❌ |
tolerance |
int |
The tolerance for grouping detections into the same line of text.. | ✅ |
delimiter |
str |
The delimiter to use for stitching text.. | ✅ |
The Refs column marks possibility to parametrise the property with dynamic values available
in workflow runtime. See Bindings for more info.
Available Connections¶
Compatible Blocks
Check what blocks you can connect to Stitch OCR Detections in version v1.
- inputs:
Template Matching,OpenAI,Line Counter,Line Counter,VLM as Detector,Path Deviation,Time in Zone,Byte Tracker,Velocity,Model Monitoring Inference Aggregator,Object Detection Model,Detections Stabilizer,Llama 3.2 Vision,LMM For Classification,Google Vision OCR,Local File Sink,Time in Zone,Slack Notification,Instance Segmentation Model,Image Contours,Clip Comparison,VLM as Detector,Object Detection Model,Overlap Filter,OCR Model,Moondream2,CSV Formatter,Twilio SMS Notification,VLM as Classifier,Webhook Sink,Dynamic Crop,Detections Consensus,Byte Tracker,Detections Classes Replacement,Email Notification,Detections Combine,OpenAI,Single-Label Classification Model,Detection Offset,Time in Zone,Detections Filter,Roboflow Custom Metadata,CogVLM,SIFT Comparison,Detections Merge,YOLO-World Model,OpenAI,SIFT Comparison,Florence-2 Model,Pixel Color Count,Detections Transformation,Roboflow Dataset Upload,Google Gemini,Stitch OCR Detections,Perspective Correction,Keypoint Detection Model,Path Deviation,EasyOCR,Distance Measurement,Anthropic Claude,PTZ Tracking (ONVIF).md),Multi-Label Classification Model,LMM,Roboflow Dataset Upload,Detections Stitch,Florence-2 Model,Byte Tracker - outputs:
Size Measurement,Keypoint Visualization,LMM For Classification,Google Vision OCR,Slack Notification,Trace Visualization,Color Visualization,Instance Segmentation Model,Polygon Zone Visualization,Halo Visualization,Triangle Visualization,Segment Anything 2 Model,Stability AI Inpainting,Image Threshold,Reference Path Visualization,Corner Visualization,Detections Classes Replacement,Ellipse Visualization,OpenAI,Time in Zone,Morphological Transformation,Roboflow Custom Metadata,Image Preprocessing,Cache Set,CogVLM,Line Counter Visualization,OpenAI,YOLO-World Model,Florence-2 Model,Roboflow Dataset Upload,Stitch OCR Detections,Path Deviation,Label Visualization,PTZ Tracking (ONVIF).md),Model Comparison Visualization,Roboflow Dataset Upload,OpenAI,Line Counter,Line Counter,Path Deviation,Polygon Visualization,Model Monitoring Inference Aggregator,Time in Zone,Instance Segmentation Model,Llama 3.2 Vision,Icon Visualization,Local File Sink,Time in Zone,Clip Comparison,Twilio SMS Notification,Moondream2,Bounding Box Visualization,Classification Label Visualization,Background Color Visualization,Webhook Sink,Dynamic Crop,Dot Visualization,Email Notification,CLIP Embedding Model,Crop Visualization,Perception Encoder Embedding Model,Mask Visualization,SIFT Comparison,Pixel Color Count,QR Code Generator,Google Gemini,Perspective Correction,Stability AI Image Generation,Distance Measurement,Contrast Equalization,Anthropic Claude,Image Blur,Cache Get,Circle Visualization,Stability AI Outpainting,LMM,Detections Stitch,Florence-2 Model
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
Stitch OCR Detections in version v1 has.
Bindings
-
input
predictions(object_detection_prediction): The output of an OCR detection model..tolerance(integer): The tolerance for grouping detections into the same line of text..delimiter(string): The delimiter to use for stitching text..
-
output
ocr_text(string): String value.
Example JSON definition of step Stitch OCR Detections in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/stitch_ocr_detections@v1",
"predictions": "$steps.my_ocr_detection_model.predictions",
"reading_direction": "right_to_left",
"tolerance": 10,
"delimiter": ""
}