mirror of
https://github.com/qurator-spk/eynollah.git
synced 2026-05-26 07:39:22 +02:00
trocr: apply do_not_mask_with_textline_contour here, too
This commit is contained in:
parent
1d67e65f11
commit
f3649adbf2
1 changed files with 4 additions and 3 deletions
|
|
@ -113,9 +113,10 @@ class Eynollah_ocr(Eynollah):
|
||||||
total_bb_coordinates.append([x, y, w, h])
|
total_bb_coordinates.append([x, y, w, h])
|
||||||
|
|
||||||
img_crop = img[y: y + h, x: x + w]
|
img_crop = img[y: y + h, x: x + w]
|
||||||
mask_poly = np.zeros(img_crop.shape[:2], dtype=np.uint8)
|
if not self.do_not_mask_with_textline_contour:
|
||||||
mask_poly = cv2.fillPoly(mask_poly, pts=[cont - [x, y]], color=1)
|
mask_poly = np.zeros(img_crop.shape[:2], dtype=np.uint8)
|
||||||
img_crop[mask_poly == 0] = 255 # FIXME: or median color?
|
mask_poly = cv2.fillPoly(mask_poly, pts=[cont - [x, y]], color=1)
|
||||||
|
img_crop[mask_poly == 0] = 255 # FIXME: or median color?
|
||||||
|
|
||||||
if h > 0.1 * w:
|
if h > 0.1 * w:
|
||||||
cropped_lines.append(resize_image(img_crop,
|
cropped_lines.append(resize_image(img_crop,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue