Fix: Typo in enlarge_canvas()

This commit is contained in:
LmeSzinc 2023-06-15 13:14:37 +08:00
parent a54826aa94
commit 30958a36f9

View File

@ -21,7 +21,7 @@ def enlarge_canvas(image):
Also enlarge into the integer multiple of 32 cause PaddleOCR will downscale images to 1/32.
"""
height, width = image.shape[:2]
length = int(max(width, width) // 32 * 32 + 32)
length = int(max(width, height) // 32 * 32 + 32)
border = (0, length - height, 0, length - width)
if sum(border) > 0:
image = cv2.copyMakeBorder(image, *border, borderType=cv2.BORDER_CONSTANT, value=(0, 0, 0))