refine: clarify rotation analysis to account for text orientation + tilt

Previous prompt only measured text baseline angle from horizontal (-45° to +45°),
missing that text can be vertical/sideways, requiring larger rotations (up to ±180°).

New guidance:
- Measure TOTAL rotation needed to make text horizontal and readable
- Account for both chassis tilt AND text orientation (horizontal vs vertical)
- Example: 22° tilt + 90° vertical text = 112° total rotation
- Allows full -180° to +180° range instead of limiting to ±45°

No changes to item identification fields, OCR rules, or crop bounds analysis.
This commit is contained in:
2026-04-22 10:01:03 +03:00
parent 92c8517663
commit 2546f8abbe

View File

@@ -90,29 +90,30 @@
- Include minimal padding (10-15 pixels) around item edges - Include minimal padding (10-15 pixels) around item edges
- Ignore background clutter, other items, hands, reflections - Ignore background clutter, other items, hands, reflections
### Rotation Analysis (CRITICAL - PRECISE TEXT ANGLE MEASUREMENT) ### Rotation Analysis (CRITICAL - ROTATION TO HORIZONTAL TEXT)
**IMPORTANT: Return SMALL angles (typically -45 to +45). Large angles (60°+) indicate measurement error.** **IMPORTANT: Return the TOTAL ROTATION ANGLE needed to make text perfectly horizontal and readable (left-to-right, top-to-bottom, standard reading position).**
**Algorithm:** **Algorithm:**
1. Locate the PRIMARY text/label on the item (part number, manufacturer, specs) 1. Locate the PRIMARY text/label on the item (part number, manufacturer, specs)
2. Imagine a perfectly horizontal line (0°) 2. Analyze BOTH the text orientation AND tilt:
3. Measure how many degrees the text baseline is rotated FROM horizontal: - Is the text currently horizontal or vertical/sideways?
- Count degrees counter-clockwise = POSITIVE value to return - Is the text tilted/rotated relative to its baseline?
- Count degrees clockwise = NEGATIVE value to return 3. Calculate TOTAL rotation to standard horizontal reading:
- LIMIT: Most items need -45° to +45°. If you calculate ±60° or more, re-examine your measurement. - Chassis/image tilt: e.g., item tilted 22° → needs -22° or +22° correction
- Text orientation: if vertical → add ±90° to the tilt correction
- Combine both to get final rotation angle
4. **Return exactly this value as `rotation_degrees`** 4. **Return exactly this value as `rotation_degrees`** (range: -180° to +180°)
- SMALL adjustments: 0° to ±30° (most common) - Counter-clockwise rotation needed = POSITIVE value
- LARGE adjustments: ±31° to ±45° (rare, carefully verify) - Clockwise rotation needed = NEGATIVE value
- EXTREME values (±60°+): Likely error — recalculate or return 0
**Measurement examples** (measure the TEXT BASELINE angle only): **Measurement examples** (TOTAL rotation to make text horizontal):
- Text reads horizontally`0` - Text already horizontal → `0`
- Text tilted slightly left (counter-clockwise), ~15-25° → `+15` to `+25` (NOT higher) - Item tilted 22° clockwise, text horizontal → `+22` (counter-clockwise to level)
- Text tilted slightly right (clockwise), ~10-20° → `-10` to `-20` (NOT lower) - Text vertical (pointing left), ~90° rotation needed → `+90`
- Text perfectly vertical pointing left → `90` (only if TRULY vertical) - Item tilted 22° clockwise AND text vertical → `+112` (22° + 90°)
- Text perfectly vertical pointing right`-90` (only if TRULY vertical) - Text pointing right (180° rotated)`-180` or `+180` (equivalent)
- If uncertain or mixed angles → `0` (safe default) - If uncertain or mixed angles → `0` (safe default)
### Confidence Score ### Confidence Score