|
|
@@ -30,15 +30,15 @@ class BasePreprocessor(BaseAdapter):
|
|
|
"""
|
|
|
pass
|
|
|
|
|
|
- def _apply_rotation(self, image: np.ndarray, rotation_label: int) -> np.ndarray:
|
|
|
+ def _apply_rotation(self, image: np.ndarray, rotation_angle: int) -> np.ndarray:
|
|
|
"""应用旋转"""
|
|
|
import cv2
|
|
|
- if rotation_label == 1: # 90度
|
|
|
- return cv2.rotate(image, cv2.ROTATE_90_CLOCKWISE)
|
|
|
- elif rotation_label == 2: # 180度
|
|
|
- return cv2.rotate(image, cv2.ROTATE_180)
|
|
|
- elif rotation_label == 3: # 270度
|
|
|
+ if rotation_angle == 90: # 90度
|
|
|
return cv2.rotate(image, cv2.ROTATE_90_COUNTERCLOCKWISE)
|
|
|
+ elif rotation_angle == 180: # 180度
|
|
|
+ return cv2.rotate(image, cv2.ROTATE_180)
|
|
|
+ elif rotation_angle == 270: # 270度
|
|
|
+ return cv2.rotate(image, cv2.ROTATE_90_CLOCKWISE)
|
|
|
return image
|
|
|
|
|
|
class BaseLayoutDetector(BaseAdapter):
|