diff --git a/config/ai_prompt.md b/config/ai_prompt.md index 5d125a7f..d7f3e3c1 100644 --- a/config/ai_prompt.md +++ b/config/ai_prompt.md @@ -92,12 +92,14 @@ ### Rotation Analysis (CRITICAL - MAKE TEXT READABLE IN STANDARD ENGLISH) - **IMPORTANT: Photos may be at ANY angle. Your job: return the rotation angle to make the TEXT readable in standard English (horizontal, left-to-right, top-to-bottom).** + **IMPORTANT: Photos may be at ANY angle. Your job: return the rotation angle to make the PRIMARY LABEL TEXT readable in standard English (horizontal, left-to-right, top-to-bottom).** - **The image has EXIF orientation metadata stripped. Analyze it in its RAW/NATIVE state. Measure how much to rotate the image so that the PRIMARY label text reads normally.** + **The image has EXIF orientation metadata stripped. Analyze it in its RAW/NATIVE state. Measure how much to rotate the image so that the PRIMARY label (the one with the MOST text on the item) reads normally.** + + **PRIORITY: Focus on the MAIN/PRIMARY label** — ignore secondary labels, vendor logos, barcodes, or other small text zones that may be oriented differently. If multiple text zones conflict, optimize for the largest one. **Algorithm:** - 1. Locate the PRIMARY text/label on the item (part number, manufacturer, specs) + 1. Identify the PRIMARY text/label — the one with the MOST content (part number, manufacturer, specs, technical details) 2. Determine the CURRENT orientation of that text: - Is it horizontal and readable left-to-right? → rotation needed: `0°` - Is it rotated 90° (vertical, pointing up)? → rotation to horizontal: `-90°` or `+90°` (depending on which way) @@ -108,14 +110,16 @@ - Negative value = clockwise rotation needed 4. **Return any value in range -180° to +180°** (full circle allowed) - **Measurement examples** (make text readable left-to-right, top-to-bottom): - - Text already reads normally horizontally → `0°` - - Text is vertical, pointing up (90° rotated) → `-90°` (rotate clockwise to make horizontal) - - Text is vertical, pointing down (270° rotated) → `+90°` (rotate counter-clockwise) - - Text is upside-down (180° rotated) → `+180°` or `-180°` (rotate half-circle) - - Text at 22° angle (tilted right) → `-22°` (rotate clockwise to level) - - Text at -35° angle (tilted left) → `+35°` (rotate counter-clockwise to level) - - **No angle limit**: Photos may be taken at any angle. Return whatever rotation makes the label text readable in standard English orientation. + **Measurement examples** (make PRIMARY label text readable left-to-right, top-to-bottom): + - Primary text already reads normally horizontally → `0°` + - Primary text is vertical, pointing up (90° rotated) → `-90°` (rotate clockwise to make horizontal) + - Primary text is vertical, pointing down (270° rotated) → `+90°` (rotate counter-clockwise) + - Primary text is upside-down (180° rotated) → `+180°` or `-180°` (rotate half-circle) + - Primary text at 22° angle (tilted right) → `-22°` (rotate clockwise to level) + - Primary text at -35° angle (tilted left) → `+35°` (rotate counter-clockwise to level) + - **Multiple labels/zones**: Item has vendor logo at 90° AND main label at 0°. → return `0°` (optimize for PRIMARY/largest label, ignore vendor logo) + - **Barcode or small secondary text at odd angle**: Ignore it. Rotate to make PRIMARY label readable. + - **No angle limit**: Photos may be taken at any angle. Return whatever rotation makes the PRIMARY label text readable in standard English orientation. ### Confidence Score - Return `confidence`: 0.0-1.0 indicating reliability of crop/rotation analysis