feat(新功能): 修复结果图宽度异常问题

fix(修复bug):
docs(文档变更):
refactor(重构):
test(增加测试):
This commit is contained in:
zhh
2025-09-16 11:47:19 +08:00
parent 16fbd5c5f2
commit ae338d9fc1
4 changed files with 21 additions and 5 deletions

View File

@@ -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"

View File

@@ -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),

View File

@@ -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)

View File

@@ -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")