diff --git a/anonymizer_core_refactored_onnx.py b/anonymizer_core_refactored_onnx.py index f5ae471..6c57ea0 100644 --- a/anonymizer_core_refactored_onnx.py +++ b/anonymizer_core_refactored_onnx.py @@ -3873,10 +3873,16 @@ def _rasterize_page(args): ry1 = y1 * zoom draw.rectangle([rx0, ry0, rx1, ry1], fill=(0, 0, 0)) # Détecter et noircir les codes-barres et QR codes + # Filtre : ignorer les faux positifs pyzbar sur les tableaux + # (les grilles de cellules sont parfois interprétées comme des codes-barres) + _MIN_BARCODE_AREA = 2000 * zoom * zoom # minimum ~2000 px² en taille originale try: from pyzbar.pyzbar import decode as _pyzbar_decode for symbol in _pyzbar_decode(img): r = symbol.rect + area = r.width * r.height + if area < _MIN_BARCODE_AREA: + continue # Trop petit — probablement un FP sur une cellule de tableau margin = int(5 * zoom) draw.rectangle([r.left - margin, r.top - margin, r.left + r.width + margin, r.top + r.height + margin],