说明
- 利用padding像素0的方式,在原始图像窄边进行填充,以此保证图片的原始比例
CODE
def __init__(self, imageSize: int = 512, device: str = "cpu"): ...
def __resize(self, image: np.ndarray, interpolation: int = cv2.INTER_AREA) -> Union[np.ndarray, bool]:
"""
对输入图像数据进行resize
@param image: 需要resize的图像数据
@param interpolation: 插值方式,cv2.INTER_AREA, cv2.INTER_CUBIC, cv2.INTER_LINEAR
@return: resize之后需要返回的数据
"""
height, width = image.shape[:2]
if width > height:
height = int(height * self