feat(新功能):

fix(修复bug):   accessories 替换为 others
docs(文档变更):
refactor(重构):
test(增加测试):
This commit is contained in:
zchengrong
2025-11-07 10:56:34 +08:00
parent 7d2149dcaf
commit e8d8b715ae
15 changed files with 36 additions and 36 deletions

View File

@@ -58,14 +58,14 @@ def organize_clothing(layer):
return front_layer, back_layer
def organize_accessories(layer):
def organize_others(layer):
# 起始坐标
start_point = (0, 0)
layer['clothes_keypoint'] = {
'accessories_left': [0, 0]
'others_left': [0, 0]
}
layer['body_point_test'] = {
'accessories_left': [0, 0]
'others_left': [0, 0]
}
start_point = calculate_start_point(layer['keypoint'], layer['scale'], layer['clothes_keypoint'], layer['body_point_test'], layer["offset"], layer["resize_scale"])

View File

@@ -79,11 +79,11 @@ def synthesis(data, size, basic_info):
_, binary_body_mask = cv2.threshold(body_mask, 127, 255, cv2.THRESH_BINARY)
top_outer_mask = np.array(binary_body_mask)
bottom_outer_mask = np.array(binary_body_mask)
accessories_outer_mask = np.array(binary_body_mask)
others_outer_mask = np.array(binary_body_mask)
top = True
bottom = True
accessories = True
others = True
i = len(data)
while i:
i -= 1
@@ -111,7 +111,7 @@ def synthesis(data, size, basic_info):
background = np.zeros_like(top_outer_mask)
background[all_y_start:all_y_end, all_x_start:all_x_end] = sketch_mask[mask_y_start:mask_y_end, mask_x_start:mask_x_end]
bottom_outer_mask = background + bottom_outer_mask
elif accessories and data[i]['name'] in ['accessories_front']:
elif others and data[i]['name'] in ['others_front']:
mask_shape = data[i]['mask'].shape
y_offset, x_offset = data[i]['adaptive_position']
# 初始化叠加区域的起始和结束位置
@@ -121,13 +121,13 @@ def synthesis(data, size, basic_info):
_, sketch_mask = cv2.threshold(data[i]['mask'], 127, 255, cv2.THRESH_BINARY)
background = np.zeros_like(top_outer_mask)
background[all_y_start:all_y_end, all_x_start:all_x_end] = sketch_mask[mask_y_start:mask_y_end, mask_x_start:mask_x_end]
accessories_outer_mask = background + accessories_outer_mask
others_outer_mask = background + others_outer_mask
pass
elif bottom is False and top is False:
break
all_mask = cv2.bitwise_or(top_outer_mask, bottom_outer_mask)
all_mask = cv2.bitwise_or(all_mask, accessories_outer_mask)
all_mask = cv2.bitwise_or(all_mask, others_outer_mask)
for layer in data:
if layer['image'] is not None: