diff --git a/app/core/config.py b/app/core/config.py index f0a2c35..5ba5298 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -20,7 +20,7 @@ class Settings(BaseSettings): OSS = "minio" -DEBUG = False +DEBUG = True if DEBUG: LOGS_PATH = "logs/" CATEGORY_PATH = "service/attribute/config/descriptor/category/category_dis.csv" diff --git a/app/service/design_fast/item.py b/app/service/design_fast/item.py index 5ddfdc7..1e84ea9 100644 --- a/app/service/design_fast/item.py +++ b/app/service/design_fast/item.py @@ -16,7 +16,7 @@ class AccessoriesItem(BaseItem): LoadImage(minio_client), # KeyPoint(), ContourDetection(), - # Segmentation(minio_client), + Segmentation(minio_client), # BackPerspective(minio_client), Color(minio_client), PrintPainting(minio_client), diff --git a/app/service/design_fast/utils/synthesis_item.py b/app/service/design_fast/utils/synthesis_item.py index d7711f3..79e53df 100644 --- a/app/service/design_fast/utils/synthesis_item.py +++ b/app/service/design_fast/utils/synthesis_item.py @@ -207,7 +207,7 @@ def update_base_size_priority(layers, size): if info['name'] == 'mannequin': new_height = info['image'].height max_x = max(x_list) - new_width = max_x - min_x + new_width = max_x - min_x * 2 # 更新坐标 for info in layers: info['adaptive_position'] = (info['position'][0], info['position'][1] - min_x) diff --git a/app/service/utils/new_oss_client.py b/app/service/utils/new_oss_client.py index 7939333..908badb 100644 --- a/app/service/utils/new_oss_client.py +++ b/app/service/utils/new_oss_client.py @@ -5,7 +5,7 @@ from io import BytesIO import cv2 import numpy as np import urllib3 -from PIL import Image +from PIL import Image, ImageDraw from minio import Minio from app.core.config import * @@ -82,7 +82,7 @@ if __name__ == '__main__': # url = "aida-users/89/sketchboard/female/Dress/e6724ab7-8d3f-4677-abe0-c3e42ab7af85.jpeg" # url = "aida-users/87/print/956614a2-7e75-4fbe-9ed0-c1831e37a2c9-4-87.png" # url = "aida-users/89/single_logo/123-89.png" - url = "aida-users/89/123-89.png" + url = "aida-sys-image/models/male/65239c72-cc59-4bd6-ac17-fc828e23b450.png" # url = "aida-collection-element/12148/Sketchboard/95ea577b-305b-4a62-b30a-39c0dd3ddb3f.png" read_type = "2" @@ -92,4 +92,20 @@ if __name__ == '__main__': cv2.waitKey(0) else: img = oss_get_image(oss_client=minio_client, bucket=url.split('/')[0], object_name=url[url.find('/') + 1:], data_type=read_type) + draw = ImageDraw.Draw(img) + # 获取图片尺寸 + width, height = img.size + img + # 计算中心点坐标 + center_x = width // 2 + center_y = height // 2 + + # 绘制垂直中心线(红色) + draw.line( + [(center_x, 0), (center_x, height)], # 从顶部到底部的垂直线 + fill=(255, 0, 0), # 红色 (R, G, B) + width=2 # 线宽 + ) + img.show() + img.save("result.png")