EasyOCR icon indicating copy to clipboard operation
EasyOCR copied to clipboard

compute_ratio_and_resize passes a PIL constant to a cv2 function

Open andreaswimmer opened this issue 1 year ago • 1 comments

utils.py contains the following code https://github.com/JaidedAI/EasyOCR/blob/c999505ef6b43be1c4ee36aa04ad979175178352/easyocr/utils.py#L566-L577

Note that Image is part of PIL https://github.com/JaidedAI/EasyOCR/blob/c999505ef6b43be1c4ee36aa04ad979175178352/easyocr/utils.py#L7-L8

Since both of these map to an integer, this is not a type error. However PIL maps LANCZOS to 1 (https://github.com/python-pillow/Pillow/blob/e47877587fb8aa1853ef7473285a2964f5e98520/src/PIL/Image.py#L158-L164 ), while a 1 means bilinear interpolation in opencv (https://docs.opencv.org/3.4/da/d54/group__imgproc__transform.html )

andreaswimmer avatar Feb 02 '24 00:02 andreaswimmer

Good find. Did you try changing the code so it passes an integer value of 4 to the openCV function? If so, did you see any performance differences?

I'm going to test this and see if it improves anything.

daniellovera avatar May 02 '24 03:05 daniellovera