diff --git a/config/ai_prompt.md b/config/ai_prompt.md index a54c1385..5aa7a31c 100644 --- a/config/ai_prompt.md +++ b/config/ai_prompt.md @@ -90,26 +90,30 @@ - Include minimal padding (10-15 pixels) around item edges - Ignore background clutter, other items, hands, reflections - ### Rotation Analysis (CRITICAL - MEASURE TEXT ANGLE) + ### Rotation Analysis (CRITICAL - PRECISE TEXT ANGLE MEASUREMENT) - **PRIORITY: Measure text orientation, not item orientation** + **IMPORTANT: Return SMALL angles (typically -45 to +45). Large angles (60°+) indicate measurement error.** - 1. **Locate readable text** on the item (part numbers, manufacturer names, specifications, labels) - 2. **Measure the baseline angle of that text**: - - Baseline = the invisible line the text sits on - - 0° = text baseline is HORIZONTAL (readable left-to-right) - - Positive degrees = text rotated counter-clockwise from horizontal - - Negative degrees = text rotated clockwise from horizontal - 3. **Return clockwise rotation needed to make text horizontal**: - - If text tilted 22° counter-clockwise → return `+22` (rotate 22° clockwise to fix) - - If text tilted 15° clockwise → return `-15` (rotate 15° counter-clockwise to fix) - - If text already horizontal → return `0` - 4. **Calibration examples** (measure the text angle precisely): - - Text reads perfectly left-to-right → `rotation_degrees: 0` - - Text tilted counter-clockwise, needs ~22° clockwise to straighten → `rotation_degrees: 22` - - Text vertical, pointing left (rotated 90° counter-clockwise) → `rotation_degrees: 90` - - Text vertical, pointing right (rotated 90° clockwise) → `rotation_degrees: -90` - - Text tilted clockwise by ~45° → `rotation_degrees: -45` + **Algorithm:** + 1. Locate the PRIMARY text/label on the item (part number, manufacturer, specs) + 2. Imagine a perfectly horizontal line (0°) + 3. Measure how many degrees the text baseline is rotated FROM horizontal: + - Count degrees counter-clockwise = POSITIVE value to return + - Count degrees clockwise = NEGATIVE value to return + - LIMIT: Most items need -45° to +45°. If you calculate ±60° or more, re-examine your measurement. + + 4. **Return exactly this value as `rotation_degrees`** + - SMALL adjustments: 0° to ±30° (most common) + - LARGE adjustments: ±31° to ±45° (rare, carefully verify) + - EXTREME values (±60°+): Likely error — recalculate or return 0 + + **Measurement examples** (measure the TEXT BASELINE angle only): + - Text reads horizontally → `0` + - Text tilted slightly left (counter-clockwise), ~15-25° → `+15` to `+25` (NOT higher) + - Text tilted slightly right (clockwise), ~10-20° → `-10` to `-20` (NOT lower) + - Text perfectly vertical pointing left → `90` (only if TRULY vertical) + - Text perfectly vertical pointing right → `-90` (only if TRULY vertical) + - If uncertain or mixed angles → `0` (safe default) ### Confidence Score - Return `confidence`: 0.0-1.0 indicating reliability of crop/rotation analysis