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@v1
to 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.. | ✅ |
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:
Detections Filter
,YOLO-World Model
,Detections Classes Replacement
,Detections Transformation
,Detections Consensus
,SIFT Comparison
,SIFT Comparison
,Line Counter
,Time in Zone
,Path Deviation
,Time in Zone
,Byte Tracker
,Pixel Color Count
,Image Contours
,Object Detection Model
,Perspective Correction
,Byte Tracker
,VLM as Detector
,Dynamic Crop
,Detections Stitch
,Overlap Filter
,Path Deviation
,PTZ Tracking (ONVIF)
.md),Velocity
,Time in Zone
,Template Matching
,VLM as Detector
,Detections Stabilizer
,Moondream2
,Detection Offset
,Distance Measurement
,Line Counter
,Detections Merge
,Google Vision OCR
,Byte Tracker
,Object Detection Model
- outputs:
Crop Visualization
,Ellipse Visualization
,Stability AI Inpainting
,Stability AI Image Generation
,Cache Get
,Circle Visualization
,YOLO-World Model
,Model Comparison Visualization
,Webhook Sink
,Stability AI Outpainting
,Bounding Box Visualization
,Time in Zone
,Time in Zone
,Path Deviation
,Background Color Visualization
,Llama 3.2 Vision
,LMM
,Twilio SMS Notification
,Label Visualization
,Triangle Visualization
,Dynamic Crop
,Florence-2 Model
,Detections Stitch
,Instance Segmentation Model
,Florence-2 Model
,Keypoint Visualization
,Halo Visualization
,PTZ Tracking (ONVIF)
.md),Corner Visualization
,Line Counter Visualization
,LMM For Classification
,CLIP Embedding Model
,Time in Zone
,Perception Encoder Embedding Model
,Dot Visualization
,Size Measurement
,Anthropic Claude
,Slack Notification
,Roboflow Dataset Upload
,Icon Visualization
,Cache Set
,Roboflow Custom Metadata
,Distance Measurement
,CogVLM
,Polygon Zone Visualization
,OpenAI
,Email Notification
,Segment Anything 2 Model
,Detections Classes Replacement
,Google Gemini
,SIFT Comparison
,Line Counter
,Pixel Color Count
,Image Threshold
,Perspective Correction
,Classification Label Visualization
,Path Deviation
,Reference Path Visualization
,Local File Sink
,OpenAI
,Instance Segmentation Model
,Color Visualization
,Model Monitoring Inference Aggregator
,Clip Comparison
,Roboflow Dataset Upload
,Mask Visualization
,QR Code Generator
,OpenAI
,Polygon Visualization
,Moondream2
,Image Blur
,Trace Visualization
,Line Counter
,Google Vision OCR
,Image Preprocessing
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..
-
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
}