feat(新功能):

fix(修复bug):  pattern_image (上色无印花sketch图),修改为不拉伸
docs(文档变更):
refactor(重构):
test(增加测试):
This commit is contained in:
zhh
2025-09-18 15:33:01 +08:00
parent 16d4844cca
commit e6da512a31

View File

@@ -67,7 +67,6 @@ class Split(object):
# mask_image = np.zeros((height, width, 3)) # mask_image = np.zeros((height, width, 3))
# mask_image[front_mask != 0] = [0, 0, 255] # mask_image[front_mask != 0] = [0, 0, 255]
# 切换为原始图片尺寸------------------------------- # 切换为原始图片尺寸-------------------------------
height, width = ori_front_mask.shape height, width = ori_front_mask.shape
mask_image = np.zeros((height, width, 3)) mask_image = np.zeros((height, width, 3))
@@ -113,7 +112,6 @@ class Split(object):
# mask_image[back_mask != 0] = [0, 255, 0] # mask_image[back_mask != 0] = [0, 255, 0]
mask_image[ori_back_mask != 0] = [0, 255, 0] mask_image[ori_back_mask != 0] = [0, 255, 0]
rbga_mask = rgb_to_rgba(mask_image, ori_front_mask + ori_back_mask) rbga_mask = rgb_to_rgba(mask_image, ori_front_mask + ori_back_mask)
mask_pil = Image.fromarray(cvtColor(rbga_mask.astype(np.uint8), COLOR_BGR2RGBA)) mask_pil = Image.fromarray(cvtColor(rbga_mask.astype(np.uint8), COLOR_BGR2RGBA))
image_data = io.BytesIO() image_data = io.BytesIO()
@@ -124,7 +122,7 @@ class Split(object):
result['mask_url'] = req.bucket_name + "/" + req.object_name result['mask_url'] = req.bucket_name + "/" + req.object_name
# 创建中间图层 # 创建中间图层
result_pattern_image_rgba = rgb_to_rgba(result['no_seg_sketch'], result['mask']) result_pattern_image_rgba = rgb_to_rgba(result['no_seg_sketch'], ori_front_mask + ori_back_mask)
result_pattern_image_pil = Image.fromarray(cvtColor(result_pattern_image_rgba, COLOR_BGR2RGBA)) result_pattern_image_pil = Image.fromarray(cvtColor(result_pattern_image_rgba, COLOR_BGR2RGBA))
result['pattern_image'], result['pattern_image_url'], _ = upload_png_mask(self.minio_client, result_pattern_image_pil, f'{generate_uuid()}') result['pattern_image'], result['pattern_image_url'], _ = upload_png_mask(self.minio_client, result_pattern_image_pil, f'{generate_uuid()}')
return result return result