feat(新功能): 模特编辑功能参数修改

fix(修复bug):
docs(文档变更):
refactor(重构):
test(增加测试):
This commit is contained in:
zhouchengrong
2025-03-25 17:33:25 +08:00
parent d029bdb944
commit 9fd911500b
3 changed files with 9 additions and 6 deletions

View File

@@ -17,14 +17,17 @@ def mannequins_edit(request_data: MannequinModel):
模特腿长调整
创建一个具有以下参数的请求体:
- **mannequins**: mannequins url等信息
- **scale**: 大腿小腿比例
- **resize_pixel**: 拉伸像素量
- **bucket_name**: bucket name
- **mannequin_name**: 模特名称
- **top**: 拉伸y轴点位
- **bottom**: 拉伸y轴点位
示例参数:
- **{
"mannequins": "aida-sys-image/models/male/dc36ce58-46c3-4b6f-8787-5ca7d6fc26e6.png",
"scale": 0.75,
"resize_pixel": -50,
"bucket_name": "test",
"mannequin_name": "mannequin_name",
"top" : 270,

View File

@@ -3,7 +3,7 @@ from pydantic import BaseModel
class MannequinModel(BaseModel):
mannequins: str
scale: float
resize_pixel: float
bucket_name: str
mannequin_name: str
top: int

View File

@@ -11,7 +11,7 @@ minio_client = Minio(MINIO_URL, access_key=MINIO_ACCESS, secret_key=MINIO_SECRET
class MannequinEditService():
def __init__(self, request_data):
self.scale = request_data.scale
self.resize_pixel = request_data.resize_pixel
self.top = request_data.top
self.bottom = request_data.bottom
self.image = oss_get_image(oss_client=minio_client, bucket=request_data.mannequins.split('/')[0], object_name=request_data.mannequins[request_data.mannequins.find('/') + 1:], data_type="cv2")
@@ -47,7 +47,7 @@ class MannequinEditService():
part_bottom = self.bgr[bottom:, :]
part_bottom_alpha = self.alpha[bottom:, :]
new_height = int((bottom - top) * self.scale)
new_height = int((bottom - top) + self.resize_pixel)
resized_thigh = cv2.resize(part_resize, (self.w, new_height), interpolation=cv2.INTER_LINEAR)
resized_thigh_alpha = cv2.resize(part_resize_alpha, (self.w, new_height), interpolation=cv2.INTER_LINEAR)
@@ -68,7 +68,7 @@ class MannequinEditService():
if __name__ == '__main__':
request_data = MannequinModel(
mannequins="aida-sys-image/models/male/dc36ce58-46c3-4b6f-8787-5ca7d6fc26e6.png",
scale=0.1,
resize_pixel=-100,
bucket_name="test",
mannequin_name="mannequin_name",
top=270,