trocr: apply do_not_mask_with_textline_contour here, too

This commit is contained in:
Robert Sachunsky 2026-05-21 17:23:11 +02:00
parent 1d67e65f11
commit f3649adbf2

View file

@ -113,6 +113,7 @@ class Eynollah_ocr(Eynollah):
total_bb_coordinates.append([x, y, w, h])
img_crop = img[y: y + h, x: x + w]
if not self.do_not_mask_with_textline_contour:
mask_poly = np.zeros(img_crop.shape[:2], dtype=np.uint8)
mask_poly = cv2.fillPoly(mask_poly, pts=[cont - [x, y]], color=1)
img_crop[mask_poly == 0] = 255 # FIXME: or median color?