diff --git a/app/service/design/items/pipelines/loading.py b/app/service/design/items/pipelines/loading.py index f0f4188..04dc4d8 100644 --- a/app/service/design/items/pipelines/loading.py +++ b/app/service/design/items/pipelines/loading.py @@ -1,6 +1,5 @@ import cv2 -from app.service.utils.decorator import RunTime, ClassCallRunTime from app.service.utils.oss_client import oss_get_image from ..builder import PIPELINES @@ -47,15 +46,18 @@ class LoadImageFromFile(object): @staticmethod def read_image(image_path): image_mask = None - # file = self.minio_client.get_object(image_path.split("/", 1)[0], image_path.split("/", 1)[1]).data - # image = cv2.imdecode(np.frombuffer(file, np.uint8), 1) - image = oss_get_image(bucket=image_path.split("/", 1)[0], object_name=image_path.split("/", 1)[1], data_type="cv2") if len(image.shape) == 2: image = cv2.cvtColor(image, cv2.COLOR_GRAY2RGB) if image.shape[2] == 4: # 如果是四通道 mask image_mask = image[:, :, 3] image = image[:, :, :3] + + if image.shape[:2] <= (50, 50): + # 计算新尺寸 + new_size = (image.shape[1] * 2, image.shape[0] * 2) + # 调整大小 + image = cv2.resize(image, new_size, interpolation=cv2.INTER_LINEAR) return image, image_mask