feat(新功能): 修复结果图宽度异常问题
fix(修复bug): docs(文档变更): refactor(重构): test(增加测试):
This commit is contained in:
@@ -20,7 +20,7 @@ class Settings(BaseSettings):
|
|||||||
|
|
||||||
|
|
||||||
OSS = "minio"
|
OSS = "minio"
|
||||||
DEBUG = False
|
DEBUG = True
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
LOGS_PATH = "logs/"
|
LOGS_PATH = "logs/"
|
||||||
CATEGORY_PATH = "service/attribute/config/descriptor/category/category_dis.csv"
|
CATEGORY_PATH = "service/attribute/config/descriptor/category/category_dis.csv"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class AccessoriesItem(BaseItem):
|
|||||||
LoadImage(minio_client),
|
LoadImage(minio_client),
|
||||||
# KeyPoint(),
|
# KeyPoint(),
|
||||||
ContourDetection(),
|
ContourDetection(),
|
||||||
# Segmentation(minio_client),
|
Segmentation(minio_client),
|
||||||
# BackPerspective(minio_client),
|
# BackPerspective(minio_client),
|
||||||
Color(minio_client),
|
Color(minio_client),
|
||||||
PrintPainting(minio_client),
|
PrintPainting(minio_client),
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ def update_base_size_priority(layers, size):
|
|||||||
if info['name'] == 'mannequin':
|
if info['name'] == 'mannequin':
|
||||||
new_height = info['image'].height
|
new_height = info['image'].height
|
||||||
max_x = max(x_list)
|
max_x = max(x_list)
|
||||||
new_width = max_x - min_x
|
new_width = max_x - min_x * 2
|
||||||
# 更新坐标
|
# 更新坐标
|
||||||
for info in layers:
|
for info in layers:
|
||||||
info['adaptive_position'] = (info['position'][0], info['position'][1] - min_x)
|
info['adaptive_position'] = (info['position'][0], info['position'][1] - min_x)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from io import BytesIO
|
|||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import urllib3
|
import urllib3
|
||||||
from PIL import Image
|
from PIL import Image, ImageDraw
|
||||||
from minio import Minio
|
from minio import Minio
|
||||||
|
|
||||||
from app.core.config import *
|
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/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/87/print/956614a2-7e75-4fbe-9ed0-c1831e37a2c9-4-87.png"
|
||||||
# url = "aida-users/89/single_logo/123-89.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"
|
# url = "aida-collection-element/12148/Sketchboard/95ea577b-305b-4a62-b30a-39c0dd3ddb3f.png"
|
||||||
read_type = "2"
|
read_type = "2"
|
||||||
@@ -92,4 +92,20 @@ if __name__ == '__main__':
|
|||||||
cv2.waitKey(0)
|
cv2.waitKey(0)
|
||||||
else:
|
else:
|
||||||
img = oss_get_image(oss_client=minio_client, bucket=url.split('/')[0], object_name=url[url.find('/') + 1:], data_type=read_type)
|
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.show()
|
||||||
|
img.save("result.png")
|
||||||
|
|||||||
Reference in New Issue
Block a user