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