Update mdr_pdf_parser.py
Browse files- mdr_pdf_parser.py +2 -2
mdr_pdf_parser.py
CHANGED
@@ -34,7 +34,7 @@ from typing import Iterable, Generator, Sequence, Callable, TypeAlias, List, Dic
|
|
34 |
from typing import Literal
|
35 |
from collections import defaultdict
|
36 |
from math import pi, ceil, sin, cos, sqrt, atan2
|
37 |
-
from PIL.Image import Image, frombytes, new as new_image, Resampling as PILResampling, Transform as PILTransform
|
38 |
from PIL.ImageOps import expand as pil_expand
|
39 |
from PIL import ImageDraw
|
40 |
from PIL.ImageFont import load_default, FreeTypeFont
|
@@ -2832,7 +2832,7 @@ class MDRExtractionEngine:
|
|
2832 |
# Convert the processed OpenCV image back to PIL Image for the optimizer
|
2833 |
# The optimizer expects a PIL Image.
|
2834 |
# The image passed to optimizer will now be the CLAHE'd version.
|
2835 |
-
processed_pil_image =
|
2836 |
print(" Engine: CLAHE preprocessing applied to input image.")
|
2837 |
optimizer = MDRImageOptimizer(processed_pil_image, adjust_points)
|
2838 |
print(" Engine: Initial OCR...")
|
|
|
34 |
from typing import Literal
|
35 |
from collections import defaultdict
|
36 |
from math import pi, ceil, sin, cos, sqrt, atan2
|
37 |
+
from PIL.Image import Image, frombytes, new as new_image, Resampling as PILResampling, Transform as PILTransform, fromarray as pil_fromarray
|
38 |
from PIL.ImageOps import expand as pil_expand
|
39 |
from PIL import ImageDraw
|
40 |
from PIL.ImageFont import load_default, FreeTypeFont
|
|
|
2832 |
# Convert the processed OpenCV image back to PIL Image for the optimizer
|
2833 |
# The optimizer expects a PIL Image.
|
2834 |
# The image passed to optimizer will now be the CLAHE'd version.
|
2835 |
+
processed_pil_image = pil_fromarray(cv2.cvtColor(processed_cv_bgr, cv2.COLOR_BGR2RGB))
|
2836 |
print(" Engine: CLAHE preprocessing applied to input image.")
|
2837 |
optimizer = MDRImageOptimizer(processed_pil_image, adjust_points)
|
2838 |
print(" Engine: Initial OCR...")
|