Fix bullet overlap disambiguation + raise red threshold to 90
Step 5i: For word_boxes with >90% x-overlap and different text, use IPA dictionary to decide which to keep (e.g. "tightly" in dict, "fighily" not). Red threshold raised from 80 to 90 to catch remaining scanner artifacts like "tight" and "5" that were still misclassified as red. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -924,13 +924,13 @@ class TestRedFalsePositiveSuppression:
|
||||
"""Red requires median_sat >= 80 to avoid scanner artifact false positives."""
|
||||
|
||||
def test_low_saturation_red_classified_as_black(self):
|
||||
"""Black text with slight warm scanner tint (sat ~60) → black, not red."""
|
||||
"""Black text with slight warm scanner tint (sat ~85) → black, not red."""
|
||||
import numpy as np
|
||||
from cv_color_detect import detect_word_colors
|
||||
|
||||
# Create a 40x20 image with dark gray pixels (slight warm tint)
|
||||
# HSV: hue=5 (red range), sat=60 (above 55 threshold but below 80), val=40
|
||||
img_hsv = np.full((40, 200, 3), [5, 60, 40], dtype=np.uint8)
|
||||
# HSV: hue=5 (red range), sat=85 (above 55 threshold but below 90), val=40
|
||||
img_hsv = np.full((40, 200, 3), [5, 85, 40], dtype=np.uint8)
|
||||
img_bgr = cv2.cvtColor(img_hsv, cv2.COLOR_HSV2BGR)
|
||||
|
||||
wb = [{"left": 10, "top": 5, "width": 50, "height": 20, "text": "test"}]
|
||||
|
||||
Reference in New Issue
Block a user