Fix: Invert planner page colors to have better ocr results

on black letters and white background
This commit is contained in:
LmeSzinc 2024-06-03 13:49:19 +08:00
parent c729421bd2
commit ed193e0767

View File

@ -1,5 +1,6 @@
import re import re
import cv2
from pponnxcr.predict_system import BoxedResult from pponnxcr.predict_system import BoxedResult
from module.base.utils import area_center, area_in_area from module.base.utils import area_center, area_in_area
@ -70,10 +71,7 @@ class OcrPlannerResult(OcrWhiteLetterOnComplexBackground, OcrItemName):
return super().detect_and_ocr(image, *args, **kwargs) return super().detect_and_ocr(image, *args, **kwargs)
def pre_process(self, image): def pre_process(self, image):
# gray = rgb2gray(image) image = cv2.subtract((255, 255, 255, 0), image)
# from PIL import Image
# Image.fromarray(gray).show()
# image = cv2.merge([gray, gray, gray])
return image return image