From 9103f3a6d41e9d703d3f869299a2f361b7c92cf8 Mon Sep 17 00:00:00 2001 From: zhh Date: Wed, 10 Sep 2025 17:38:59 +0800 Subject: [PATCH 01/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:=20docs?= =?UTF-8?q?=EF=BC=88=E6=96=87=E6=A1=A3=E5=8F=98=E6=9B=B4=EF=BC=89:=20refac?= =?UTF-8?q?tor=EF=BC=88=E9=87=8D=E6=9E=84=EF=BC=89:=20test(=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=B5=8B=E8=AF=95):=20=20mask=20=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=8E=9F=E5=B0=BA=E5=AF=B8=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/pipeline/split.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/app/service/design_fast/pipeline/split.py b/app/service/design_fast/pipeline/split.py index 88e8e75..ff73883 100644 --- a/app/service/design_fast/pipeline/split.py +++ b/app/service/design_fast/pipeline/split.py @@ -20,8 +20,9 @@ class Split(object): def __call__(self, result): try: - if result['name'] in ('outwear', 'dress', 'blouse', 'skirt', 'trousers', 'tops', 'bottoms', 'accessories'): + ori_front_mask = result['front_mask'].copy() + ori_back_mask = result['back_mask'].copy() if result['resize_scale'][0] == 1.0 and result['resize_scale'][1] == 1.0: front_mask = result['front_mask'] @@ -61,9 +62,17 @@ class Split(object): result_front_image_pil = sketch_to_transparent(result_front_image_pil, front_mask, transparent["scale"]) result['front_image'], result["front_image_url"], _ = upload_png_mask(self.minio_client, result_front_image_pil, f'{generate_uuid()}', mask=None) - height, width = front_mask.shape + # 前片部分 (红图部分) + # height, width = front_mask.shape + # mask_image = np.zeros((height, width, 3)) + # mask_image[front_mask != 0] = [0, 0, 255] + + + # 切换为原始图片尺寸------------------------------- + height, width = ori_front_mask.shape mask_image = np.zeros((height, width, 3)) - mask_image[front_mask != 0] = [0, 0, 255] + mask_image[ori_front_mask != 0] = [0, 0, 255] + # ----------------------------------------------- # if result["name"] in ('blouse', 'dress', 'outwear', 'tops'): # result_back_image = np.zeros_like(rgba_image) @@ -100,9 +109,12 @@ class Split(object): result_back_image[back_mask != 0] = rgba_image[back_mask != 0] result_back_image_pil = Image.fromarray(cvtColor(result_back_image, COLOR_BGR2RGBA)) result['back_image'], result["back_image_url"], _ = upload_png_mask(self.minio_client, result_back_image_pil, f'{generate_uuid()}', mask=None) - mask_image[back_mask != 0] = [0, 255, 0] - rbga_mask = rgb_to_rgba(mask_image, front_mask + back_mask) + # mask_image[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) mask_pil = Image.fromarray(cvtColor(rbga_mask.astype(np.uint8), COLOR_BGR2RGBA)) image_data = io.BytesIO() mask_pil.save(image_data, format='PNG') @@ -110,6 +122,7 @@ class Split(object): image_bytes = image_data.read() req = oss_upload_image(oss_client=self.minio_client, bucket=AIDA_CLOTHING, object_name=f"mask/mask_{generate_uuid()}.png", image_bytes=image_bytes) result['mask_url'] = req.bucket_name + "/" + req.object_name + # 创建中间图层 result_pattern_image_rgba = rgb_to_rgba(result['pattern_image'], result['mask']) result_pattern_image_pil = Image.fromarray(cvtColor(result_pattern_image_rgba, COLOR_BGR2RGBA)) From 05bb3ff3faebcf4dbbf2301d7d53477be0e973ef Mon Sep 17 00:00:00 2001 From: zhh Date: Wed, 10 Sep 2025 17:58:54 +0800 Subject: [PATCH 02/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20=20=20=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89?= =?UTF-8?q?:=20docs=EF=BC=88=E6=96=87=E6=A1=A3=E5=8F=98=E6=9B=B4=EF=BC=89:?= =?UTF-8?q?=20refactor=EF=BC=88=E9=87=8D=E6=9E=84=EF=BC=89:=20test(?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/api_test.py | 4 +++- app/core/config.py | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/api/api_test.py b/app/api/api_test.py index a7b965c..c7bdb62 100644 --- a/app/api/api_test.py +++ b/app/api/api_test.py @@ -4,7 +4,8 @@ import logging from fastapi import APIRouter from fastapi import HTTPException -from app.core.config import SR_RABBITMQ_QUEUES, GI_RABBITMQ_QUEUES, GPI_RABBITMQ_QUEUES, GRI_RABBITMQ_QUEUES, OSS, JAVA_STREAM_API_URL, GMV_RABBITMQ_QUEUES, SLOGAN_RABBITMQ_QUEUES, GEN_SINGLE_LOGO_RABBITMQ_QUEUES, PS_RABBITMQ_QUEUES, BATCH_GPI_RABBITMQ_QUEUES, BATCH_GRI_RABBITMQ_QUEUES, BATCH_PS_RABBITMQ_QUEUES +from app.core.config import SR_RABBITMQ_QUEUES, GI_RABBITMQ_QUEUES, GPI_RABBITMQ_QUEUES, GRI_RABBITMQ_QUEUES, OSS, JAVA_STREAM_API_URL, GMV_RABBITMQ_QUEUES, SLOGAN_RABBITMQ_QUEUES, GEN_SINGLE_LOGO_RABBITMQ_QUEUES, PS_RABBITMQ_QUEUES, BATCH_GPI_RABBITMQ_QUEUES, BATCH_GRI_RABBITMQ_QUEUES, \ + BATCH_PS_RABBITMQ_QUEUES, RABBITMQ_ENV from app.schemas.response_template import ResponseModel logger = logging.getLogger() @@ -14,6 +15,7 @@ router = APIRouter() @router.get("{id}") def test(id: int): data = { + "RABBITMQ_ENV":RABBITMQ_ENV, "超分 SR_RABBITMQ_QUEUES": SR_RABBITMQ_QUEUES, "多视角 GMV_RABBITMQ_QUEUES": GMV_RABBITMQ_QUEUES, "pose transform PS_RABBITMQ_QUEUES": PS_RABBITMQ_QUEUES, diff --git a/app/core/config.py b/app/core/config.py index 2abe29c..f0a2c35 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -9,11 +9,11 @@ load_dotenv(os.path.join(BASE_DIR, '.env')) class Settings(BaseSettings): - PROJECT_NAME: str = os.getenv('PROJECT_NAME', 'FASTAPI BASE') - SECRET_KEY: str = os.getenv('SECRET_KEY', '') + PROJECT_NAME: str = 'FASTAPI BASE' + SECRET_KEY: str = '' API_PREFIX: str = '' BACKEND_CORS_ORIGINS: list[str] = ['*'] - DATABASE_URL: str = os.getenv('SQL_DATABASE_URL', '') + DATABASE_URL: str = '' ACCESS_TOKEN_EXPIRE_SECONDS: int = 60 * 60 * 24 * 7 # Token expired after 7 days SECURITY_ALGORITHM: str = 'HS256' LOGGING_CONFIG_FILE: str = os.path.join(BASE_DIR, 'logging_env.py') @@ -36,12 +36,14 @@ else: RECOMMEND_PATH_PREFIX = "app/service/recommend/" CHROMADB_PATH = "/chromadb/" - -RABBITMQ_ENV = "-prod" # 生产环境# -# RABBITMQ_ENV = "-dev" # 开发环境 +# RABBITMQ_ENV = "" # 生产环境 +RABBITMQ_ENV = os.getenv("RABBITMQ_ENV", "-dev") # RABBITMQ_ENV = "-local" # 本地测试环境 -JAVA_STREAM_API_URL = os.getenv("JAVA_STREAM_API_URL", "https://api.aida.com.hk/api/third/party/receiveDesignResults") +if RABBITMQ_ENV == "-dev": + JAVA_STREAM_API_URL = f"https://develop.api.aida.com.hk/api/third/party/receiveDesignResults" +elif RABBITMQ_ENV == "-prod": + JAVA_STREAM_API_URL = f"https://api.aida.com.hk/api/third/party/receiveDesignResults" settings = Settings() @@ -106,7 +108,7 @@ OPENAI_MODEL_LIST = {"gpt-3.5-turbo-0613", SR_MODEL_NAME = "super_resolution" SR_TRITON_URL = "10.1.1.240:10031" SR_MINIO_BUCKET = "aida-users" -SR_RABBITMQ_QUEUES = os.getenv("SR_RABBITMQ_QUEUES", f"SuperResolution{RABBITMQ_ENV}") +SR_RABBITMQ_QUEUES = f"SuperResolution{RABBITMQ_ENV}" # GenerateImage service config FAST_GI_MODEL_URL = '10.1.1.243:10011' From 34437632cf3a82e6dd171a555ab164b241f95550 Mon Sep 17 00:00:00 2001 From: zhh Date: Thu, 11 Sep 2025 14:48:43 +0800 Subject: [PATCH 03/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:=20docs?= =?UTF-8?q?=EF=BC=88=E6=96=87=E6=A1=A3=E5=8F=98=E6=9B=B4=EF=BC=89:=20refac?= =?UTF-8?q?tor=EF=BC=88=E9=87=8D=E6=9E=84=EF=BC=89:=20test(=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=B5=8B=E8=AF=95):=20=20java=E5=90=8E=E7=AB=AFdesign?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/design_generate.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/service/design_fast/design_generate.py b/app/service/design_fast/design_generate.py index 7413997..e5cea47 100644 --- a/app/service/design_fast/design_generate.py +++ b/app/service/design_fast/design_generate.py @@ -201,9 +201,10 @@ def design_generate_v2(request_data): # 发送结果给java端 url = JAVA_STREAM_API_URL # xu_pei_test_url = "https://cd21b9110505.ngrok-free.app/api/third/party/receiveDesignResults" - + tianxaing_test_url = "https://c47266b932ab.ngrok-free.app/api/third/party/receiveDesignResults" logger.info(f"java 回调 -> {url}") # logger.info(f"xupei java 回调 -> {xu_pei_test_url}") + logger.info(f"tianxiang java 回调 -> {tianxaing_test_url}") headers = { 'Accept': "*/*", @@ -218,10 +219,13 @@ def design_generate_v2(request_data): # 打印结果 logger.info(response.text) - # response = post_request(xu_pei_test_url, json_data=items_response, headers=headers) - # if response: + # test_response = post_request(xu_pei_test_url, json_data=items_response, headers=headers) + test_response = post_request(tianxaing_test_url, json_data=items_response, headers=headers) + + if test_response: # 打印结果 - # logger.info(f"xupei test response : {response.text}") + # logger.info(f"xupei test response : {test_response.text}") + logger.info(f"tianxiang test response : {test_response.text}") for step, object in enumerate(objects_data): t = threading.Thread(target=process_object, args=(step, object)) From 16fbd5c5f2fe27616422041c2b352b20ccc79097 Mon Sep 17 00:00:00 2001 From: zhh Date: Tue, 16 Sep 2025 09:42:41 +0800 Subject: [PATCH 04/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:=20docs?= =?UTF-8?q?=EF=BC=88=E6=96=87=E6=A1=A3=E5=8F=98=E6=9B=B4=EF=BC=89:=20refac?= =?UTF-8?q?tor=EF=BC=88=E9=87=8D=E6=9E=84=EF=BC=89:=20test(=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=B5=8B=E8=AF=95):=20=20java=E5=90=8E=E7=AB=AFdesign?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/design_generate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/service/design_fast/design_generate.py b/app/service/design_fast/design_generate.py index e5cea47..786c6ba 100644 --- a/app/service/design_fast/design_generate.py +++ b/app/service/design_fast/design_generate.py @@ -201,7 +201,7 @@ def design_generate_v2(request_data): # 发送结果给java端 url = JAVA_STREAM_API_URL # xu_pei_test_url = "https://cd21b9110505.ngrok-free.app/api/third/party/receiveDesignResults" - tianxaing_test_url = "https://c47266b932ab.ngrok-free.app/api/third/party/receiveDesignResults" + tianxaing_test_url = "https://c2ae520723c9.ngrok-free.app/api/third/party/receiveDesignResults" logger.info(f"java 回调 -> {url}") # logger.info(f"xupei java 回调 -> {xu_pei_test_url}") logger.info(f"tianxiang java 回调 -> {tianxaing_test_url}") From ae338d9fc1cec6ab5562dcb698db20262d55c910 Mon Sep 17 00:00:00 2001 From: zhh Date: Tue, 16 Sep 2025 11:47:19 +0800 Subject: [PATCH 05/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20=20=E4=BF=AE=E5=A4=8D=E7=BB=93=E6=9E=9C=E5=9B=BE?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98=20fix?= =?UTF-8?q?=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:=20docs=EF=BC=88?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E5=8F=98=E6=9B=B4=EF=BC=89:=20refactor?= =?UTF-8?q?=EF=BC=88=E9=87=8D=E6=9E=84=EF=BC=89:=20test(=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=B5=8B=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 2 +- app/service/design_fast/item.py | 2 +- .../design_fast/utils/synthesis_item.py | 2 +- app/service/utils/new_oss_client.py | 20 +++++++++++++++++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index f0a2c35..5ba5298 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -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" diff --git a/app/service/design_fast/item.py b/app/service/design_fast/item.py index 5ddfdc7..1e84ea9 100644 --- a/app/service/design_fast/item.py +++ b/app/service/design_fast/item.py @@ -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), diff --git a/app/service/design_fast/utils/synthesis_item.py b/app/service/design_fast/utils/synthesis_item.py index d7711f3..79e53df 100644 --- a/app/service/design_fast/utils/synthesis_item.py +++ b/app/service/design_fast/utils/synthesis_item.py @@ -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) diff --git a/app/service/utils/new_oss_client.py b/app/service/utils/new_oss_client.py index 7939333..908badb 100644 --- a/app/service/utils/new_oss_client.py +++ b/app/service/utils/new_oss_client.py @@ -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") From 633a6b8618c4779b19663bd704776e5ed1fc2cf5 Mon Sep 17 00:00:00 2001 From: zhh Date: Tue, 16 Sep 2025 11:49:16 +0800 Subject: [PATCH 06/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20=20=E4=BF=AE=E5=A4=8D=E7=BB=93=E6=9E=9C=E5=9B=BE?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98=20fix?= =?UTF-8?q?=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:=20docs=EF=BC=88?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E5=8F=98=E6=9B=B4=EF=BC=89:=20refactor?= =?UTF-8?q?=EF=BC=88=E9=87=8D=E6=9E=84=EF=BC=89:=20test(=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=B5=8B=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/core/config.py b/app/core/config.py index 5ba5298..f0a2c35 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -20,7 +20,7 @@ class Settings(BaseSettings): OSS = "minio" -DEBUG = True +DEBUG = False if DEBUG: LOGS_PATH = "logs/" CATEGORY_PATH = "service/attribute/config/descriptor/category/category_dis.csv" From 80fed45b16703a5cdb45ac36397b97029cb3a531 Mon Sep 17 00:00:00 2001 From: zhh Date: Tue, 16 Sep 2025 16:50:00 +0800 Subject: [PATCH 07/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:=20=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=85=8D=E9=A5=B0=E4=BD=8D=E7=BD=AE=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=20docs=EF=BC=88=E6=96=87=E6=A1=A3=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=EF=BC=89:=20refactor=EF=BC=88=E9=87=8D=E6=9E=84=EF=BC=89:=20te?= =?UTF-8?q?st(=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/item.py | 2 +- app/service/design_fast/utils/organize.py | 9 +++++++++ app/service/utils/new_oss_client.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/service/design_fast/item.py b/app/service/design_fast/item.py index 1e84ea9..30aa309 100644 --- a/app/service/design_fast/item.py +++ b/app/service/design_fast/item.py @@ -15,7 +15,7 @@ class AccessoriesItem(BaseItem): self.Accessories_pipeline = [ LoadImage(minio_client), # KeyPoint(), - ContourDetection(), + # ContourDetection(), Segmentation(minio_client), # BackPerspective(minio_client), Color(minio_client), diff --git a/app/service/design_fast/utils/organize.py b/app/service/design_fast/utils/organize.py index 33edc4f..26bfa48 100644 --- a/app/service/design_fast/utils/organize.py +++ b/app/service/design_fast/utils/organize.py @@ -58,6 +58,15 @@ def organize_clothing(layer): def organize_accessories(layer): # 起始坐标 start_point = (0, 0) + layer['clothes_keypoint'] = { + 'accessories_left': [0, 0] + } + layer['body_point_test'] = { + 'accessories_left': [0, 0] + } + + start_point = calculate_start_point(layer['keypoint'], layer['scale'], layer['clothes_keypoint'], layer['body_point_test'], layer["offset"], layer["resize_scale"]) + # 前片数据 front_layer = dict(priority=layer['priority'] if layer.get("layer_order", False) else PRIORITY_DICT.get(f'{layer["name"].lower()}_front', None), name=f'{layer["name"].lower()}_front', diff --git a/app/service/utils/new_oss_client.py b/app/service/utils/new_oss_client.py index 908badb..2f292f6 100644 --- a/app/service/utils/new_oss_client.py +++ b/app/service/utils/new_oss_client.py @@ -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-sys-image/models/male/65239c72-cc59-4bd6-ac17-fc828e23b450.png" + url = "aida-results/result_d2577888-92d7-11f0-9cfd-e0d362103998.png" # url = "aida-collection-element/12148/Sketchboard/95ea577b-305b-4a62-b30a-39c0dd3ddb3f.png" read_type = "2" From 978e0d998d1837cbcc1ea501a4ba57b978fff08e Mon Sep 17 00:00:00 2001 From: zhh Date: Thu, 18 Sep 2025 15:05:31 +0800 Subject: [PATCH 08/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:=20=20p?= =?UTF-8?q?attern=5Fimage=20(=E4=B8=8A=E8=89=B2=E6=97=A0=E5=8D=B0=E8=8A=B1?= =?UTF-8?q?sketch=E5=9B=BE)=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=BA=E4=B8=8D?= =?UTF-8?q?=E6=8B=89=E4=BC=B8=20docs=EF=BC=88=E6=96=87=E6=A1=A3=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=EF=BC=89:=20refactor=EF=BC=88=E9=87=8D=E6=9E=84?= =?UTF-8?q?=EF=BC=89:=20test(=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/pipeline/color.py | 2 ++ app/service/design_fast/pipeline/split.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/service/design_fast/pipeline/color.py b/app/service/design_fast/pipeline/color.py index d6c84e4..792cec2 100644 --- a/app/service/design_fast/pipeline/color.py +++ b/app/service/design_fast/pipeline/color.py @@ -59,6 +59,8 @@ class Color: tmp2 = (result['final_image'] * (temp_fg / 255)).astype(np.uint8) result['single_image'] = cv2.add(tmp1, tmp2) result['alpha'] = 100 / 255.0 + + result['no_seg_sketch'] = result['final_image'].copy() return result def get_gradient(self, bucket_name, object_name): diff --git a/app/service/design_fast/pipeline/split.py b/app/service/design_fast/pipeline/split.py index ff73883..9b530fc 100644 --- a/app/service/design_fast/pipeline/split.py +++ b/app/service/design_fast/pipeline/split.py @@ -124,7 +124,7 @@ class Split(object): result['mask_url'] = req.bucket_name + "/" + req.object_name # 创建中间图层 - result_pattern_image_rgba = rgb_to_rgba(result['pattern_image'], result['mask']) + result_pattern_image_rgba = rgb_to_rgba(result['no_seg_sketch'], result['mask']) 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()}') return result From 16d4844cca56e17bbb90012e24733932ea2c2bb0 Mon Sep 17 00:00:00 2001 From: zhh Date: Thu, 18 Sep 2025 15:17:51 +0800 Subject: [PATCH 09/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:=20=20p?= =?UTF-8?q?attern=5Fimage=20(=E4=B8=8A=E8=89=B2=E6=97=A0=E5=8D=B0=E8=8A=B1?= =?UTF-8?q?sketch=E5=9B=BE)=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=BA=E4=B8=8D?= =?UTF-8?q?=E6=8B=89=E4=BC=B8=20docs=EF=BC=88=E6=96=87=E6=A1=A3=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=EF=BC=89:=20refactor=EF=BC=88=E9=87=8D=E6=9E=84?= =?UTF-8?q?=EF=BC=89:=20test(=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/pipeline/color.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/service/design_fast/pipeline/color.py b/app/service/design_fast/pipeline/color.py index 792cec2..e1d7edc 100644 --- a/app/service/design_fast/pipeline/color.py +++ b/app/service/design_fast/pipeline/color.py @@ -22,7 +22,7 @@ class Color: resize_pattern = cv2.resize(pattern, (dim_image_w, dim_image_h), interpolation=cv2.INTER_AREA) # 无色 elif "color" not in result.keys() or result['color'] == "": - result['final_image'] = result['pattern_image'] = result['single_image'] = result['image'] + result['no_seg_sketch'] = result['final_image'] = result['pattern_image'] = result['single_image'] = result['image'] result['alpha'] = 100 / 255.0 return result # 正常颜色 From e6da512a3136cc950ba1d77c0d691ca35a062515 Mon Sep 17 00:00:00 2001 From: zhh Date: Thu, 18 Sep 2025 15:33:01 +0800 Subject: [PATCH 10/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:=20=20p?= =?UTF-8?q?attern=5Fimage=20(=E4=B8=8A=E8=89=B2=E6=97=A0=E5=8D=B0=E8=8A=B1?= =?UTF-8?q?sketch=E5=9B=BE)=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=BA=E4=B8=8D?= =?UTF-8?q?=E6=8B=89=E4=BC=B8=20docs=EF=BC=88=E6=96=87=E6=A1=A3=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=EF=BC=89:=20refactor=EF=BC=88=E9=87=8D=E6=9E=84?= =?UTF-8?q?=EF=BC=89:=20test(=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/pipeline/split.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/service/design_fast/pipeline/split.py b/app/service/design_fast/pipeline/split.py index 9b530fc..1abba05 100644 --- a/app/service/design_fast/pipeline/split.py +++ b/app/service/design_fast/pipeline/split.py @@ -67,7 +67,6 @@ class Split(object): # mask_image = np.zeros((height, width, 3)) # mask_image[front_mask != 0] = [0, 0, 255] - # 切换为原始图片尺寸------------------------------- height, width = ori_front_mask.shape mask_image = np.zeros((height, width, 3)) @@ -113,7 +112,6 @@ class Split(object): # mask_image[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) mask_pil = Image.fromarray(cvtColor(rbga_mask.astype(np.uint8), COLOR_BGR2RGBA)) image_data = io.BytesIO() @@ -124,7 +122,7 @@ class Split(object): 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'], result['pattern_image_url'], _ = upload_png_mask(self.minio_client, result_pattern_image_pil, f'{generate_uuid()}') return result From 6da3712a769abcd28c1631b302f0360c325e97ad Mon Sep 17 00:00:00 2001 From: zhh Date: Fri, 19 Sep 2025 10:40:21 +0800 Subject: [PATCH 11/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:=20=20?= =?UTF-8?q?=E5=8D=B0=E8=8A=B1=E5=9D=90=E6=A0=87=E8=AE=A1=E7=AE=97=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E6=96=B0=E5=A2=9Esketch=E6=8B=89=E4=BC=B8=E6=AF=94?= =?UTF-8?q?=E4=BE=8B=20docs=EF=BC=88=E6=96=87=E6=A1=A3=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=EF=BC=89:=20refactor=EF=BC=88=E9=87=8D=E6=9E=84=EF=BC=89:=20te?= =?UTF-8?q?st(=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design_fast/pipeline/print_painting.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/service/design_fast/pipeline/print_painting.py b/app/service/design_fast/pipeline/print_painting.py index 2d054a8..e38ba95 100644 --- a/app/service/design_fast/pipeline/print_painting.py +++ b/app/service/design_fast/pipeline/print_painting.py @@ -24,6 +24,8 @@ class PrintPainting: if result['resize_scale'][0] == 1.0 and result['resize_scale'][1] == 1.0: pass else: + # 2025-9-19 印花调整 印花坐标按照sketch的缩放比调整 + overall_print['location'][0] = [x * y for x, y in zip(overall_print['location'][0], result['resize_scale'])] height, width = result['pattern_image'].shape[:2] new_width = int(width * result['resize_scale'][0]) new_height = int(height * result['resize_scale'][1]) @@ -50,6 +52,9 @@ class PrintPainting: result['single_image'] = result['final_image'] = result['pattern_image'] = result['print_image'] if single_print['print_path_list']: + # 2025-9-19 印花调整 印花坐标按照sketch的缩放比调整 + sketch_resize_scale = result['resize_scale'] + print_background = np.zeros((result['pattern_image'].shape[0], result['pattern_image'].shape[1], 3), dtype=np.uint8) mask_background = np.zeros((result['pattern_image'].shape[0], result['pattern_image'].shape[1], 3), dtype=np.uint8) for i in range(len(single_print['print_path_list'])): @@ -67,8 +72,8 @@ class PrintPainting: rotated_resized_source_mask = resized_source_mask.rotate(-single_print['print_angle_list'][i]) source_image_pil = Image.fromarray(cv2.cvtColor(print_background, cv2.COLOR_BGR2RGB)) source_image_pil_mask = Image.fromarray(cv2.cvtColor(mask_background, cv2.COLOR_BGR2RGB)) - source_image_pil.paste(rotated_resized_source, (int(single_print['location'][i][0]), int(single_print['location'][i][1])), rotated_resized_source) - source_image_pil_mask.paste(rotated_resized_source_mask, (int(single_print['location'][i][0]), int(single_print['location'][i][1])), rotated_resized_source_mask) + source_image_pil.paste(rotated_resized_source, (int(single_print['location'][i][0] * sketch_resize_scale[0]), int(single_print['location'][i][1] * sketch_resize_scale[1])), rotated_resized_source) + source_image_pil_mask.paste(rotated_resized_source_mask, (int(single_print['location'][i][0] * sketch_resize_scale[0]), int(single_print['location'][i][1] * sketch_resize_scale[1])), rotated_resized_source_mask) print_background = cv2.cvtColor(np.array(source_image_pil), cv2.COLOR_RGBA2BGR) mask_background = cv2.cvtColor(np.array(source_image_pil_mask), cv2.COLOR_RGBA2BGR) ret, mask_background = cv2.threshold(mask_background, 124, 255, cv2.THRESH_BINARY) @@ -156,6 +161,9 @@ class PrintPainting: result['single_image'] = cv2.add(tmp1, tmp2) if element_print['element_path_list']: + # 2025-9-19 印花调整 印花坐标按照sketch的缩放比调整 + sketch_resize_scale = result['resize_scale'] + print_background = np.zeros((result['final_image'].shape[0], result['final_image'].shape[1], 3), dtype=np.uint8) mask_background = np.zeros((result['final_image'].shape[0], result['final_image'].shape[1], 3), dtype=np.uint8) for i in range(len(element_print['element_path_list'])): @@ -173,8 +181,8 @@ class PrintPainting: source_image_pil = Image.fromarray(cv2.cvtColor(print_background, cv2.COLOR_BGR2RGB)) source_image_pil_mask = Image.fromarray(cv2.cvtColor(mask_background, cv2.COLOR_BGR2RGB)) - source_image_pil.paste(rotated_resized_source, (int(element_print['location'][i][0]), int(element_print['location'][i][1])), rotated_resized_source) - source_image_pil_mask.paste(rotated_resized_source_mask, (int(element_print['location'][i][0]), int(element_print['location'][i][1])), rotated_resized_source_mask) + source_image_pil.paste(rotated_resized_source, (int(element_print['location'][i][0] * sketch_resize_scale[0]), int(element_print['location'][i][1] * sketch_resize_scale[1])), rotated_resized_source) + source_image_pil_mask.paste(rotated_resized_source_mask, (int(element_print['location'][i][0] * sketch_resize_scale[1]), int(element_print['location'][i][1] * sketch_resize_scale[1])), rotated_resized_source_mask) print_background = cv2.cvtColor(np.array(source_image_pil), cv2.COLOR_RGBA2BGR) mask_background = cv2.cvtColor(np.array(source_image_pil_mask), cv2.COLOR_RGBA2BGR) From 31e848e8bbad4be61850fbdb58b27e0d709c8933 Mon Sep 17 00:00:00 2001 From: zhh Date: Mon, 22 Sep 2025 10:41:09 +0800 Subject: [PATCH 12/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20=20=20=E7=81=B0=E8=89=B2sketch=E5=9B=BE=E4=BD=BFpr?= =?UTF-8?q?int=E9=A2=9C=E8=89=B2=E5=8F=98=E6=9A=97=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E6=96=B9=E6=A1=88=E6=B5=8B=E8=AF=95=20fix=EF=BC=88=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dbug=EF=BC=89:=20docs=EF=BC=88=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=EF=BC=89:=20refactor=EF=BC=88=E9=87=8D?= =?UTF-8?q?=E6=9E=84=EF=BC=89:=20test(=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/pipeline/print_painting.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/service/design_fast/pipeline/print_painting.py b/app/service/design_fast/pipeline/print_painting.py index e38ba95..2c5711b 100644 --- a/app/service/design_fast/pipeline/print_painting.py +++ b/app/service/design_fast/pipeline/print_painting.py @@ -151,7 +151,12 @@ class PrintPainting: img_bg = cv2.bitwise_and(result['pattern_image'], result['pattern_image'], mask=cv2.bitwise_not(print_mask)) mask_mo = np.expand_dims(print_mask, axis=2).repeat(3, axis=2) gray_mo = np.expand_dims(result['gray'], axis=2).repeat(3, axis=2) - img_fg = (img_fg * (mask_mo / 255) * (gray_mo / 255)).astype(np.uint8) + # img_fg = (img_fg * (mask_mo / 255) * (gray_mo / 255)).astype(np.uint8) + # img_fg = (img_fg * (gray_mo / 255)).astype(np.uint8) # 只保留gray影响 - 无效 + img_fg = (img_fg * (mask_mo / 255) * (1.5 * gray_mo / 255)).astype(np.uint8) # 增加系数权重,减轻变暗效果 + + + result['final_image'] = cv2.add(img_bg, img_fg) canvas = np.full_like(result['final_image'], 255) temp_bg = np.expand_dims(cv2.bitwise_not(result['mask']), axis=2).repeat(3, axis=2) From 8bc1ea576e5422092bc75d486eb15bbf7548606d Mon Sep 17 00:00:00 2001 From: zhh Date: Mon, 22 Sep 2025 10:48:58 +0800 Subject: [PATCH 13/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:=20=20o?= =?UTF-8?q?verall=20=E5=9D=90=E6=A0=87=E7=AE=97=E6=B3=95=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=AF=94=E4=BE=8B=E5=8F=82=E6=95=B0=20docs=EF=BC=88=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E5=8F=98=E6=9B=B4=EF=BC=89:=20refactor=EF=BC=88?= =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=89:=20test(=E5=A2=9E=E5=8A=A0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/pipeline/print_painting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/service/design_fast/pipeline/print_painting.py b/app/service/design_fast/pipeline/print_painting.py index 2c5711b..df35bde 100644 --- a/app/service/design_fast/pipeline/print_painting.py +++ b/app/service/design_fast/pipeline/print_painting.py @@ -25,7 +25,6 @@ class PrintPainting: pass else: # 2025-9-19 印花调整 印花坐标按照sketch的缩放比调整 - overall_print['location'][0] = [x * y for x, y in zip(overall_print['location'][0], result['resize_scale'])] height, width = result['pattern_image'].shape[:2] new_width = int(width * result['resize_scale'][0]) new_height = int(height * result['resize_scale'][1]) @@ -36,6 +35,7 @@ class PrintPainting: result['gray'] = cv2.resize(result['gray'], (new_width, new_height)) if overall_print['print_path_list']: + overall_print['location'][0] = [x * y for x, y in zip(overall_print['location'][0], result['resize_scale'])] painting_dict = {'dim_image_h': result['pattern_image'].shape[0], 'dim_image_w': result['pattern_image'].shape[1]} result['print_image'] = result['pattern_image'] if "print_angle_list" in overall_print.keys() and overall_print['print_angle_list'][0] != 0: From 47e991cd765b5996b1fc3c8ea25a387e0b3523b5 Mon Sep 17 00:00:00 2001 From: zhh Date: Mon, 22 Sep 2025 10:53:46 +0800 Subject: [PATCH 14/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20=20=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:?= =?UTF-8?q?=20:=20refactor=EF=BC=88=E9=87=8D=E6=9E=84=EF=BC=89:=20test(?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/pipeline/print_painting.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/service/design_fast/pipeline/print_painting.py b/app/service/design_fast/pipeline/print_painting.py index df35bde..d2ef1b7 100644 --- a/app/service/design_fast/pipeline/print_painting.py +++ b/app/service/design_fast/pipeline/print_painting.py @@ -35,7 +35,7 @@ class PrintPainting: result['gray'] = cv2.resize(result['gray'], (new_width, new_height)) if overall_print['print_path_list']: - overall_print['location'][0] = [x * y for x, y in zip(overall_print['location'][0], result['resize_scale'])] + overall_print['location'][0] = [x * y for x, y in zip(overall_print['location'][0], result['resize_scale'])] painting_dict = {'dim_image_h': result['pattern_image'].shape[0], 'dim_image_w': result['pattern_image'].shape[1]} result['print_image'] = result['pattern_image'] if "print_angle_list" in overall_print.keys() and overall_print['print_angle_list'][0] != 0: @@ -151,11 +151,7 @@ class PrintPainting: img_bg = cv2.bitwise_and(result['pattern_image'], result['pattern_image'], mask=cv2.bitwise_not(print_mask)) mask_mo = np.expand_dims(print_mask, axis=2).repeat(3, axis=2) gray_mo = np.expand_dims(result['gray'], axis=2).repeat(3, axis=2) - # img_fg = (img_fg * (mask_mo / 255) * (gray_mo / 255)).astype(np.uint8) - # img_fg = (img_fg * (gray_mo / 255)).astype(np.uint8) # 只保留gray影响 - 无效 - img_fg = (img_fg * (mask_mo / 255) * (1.5 * gray_mo / 255)).astype(np.uint8) # 增加系数权重,减轻变暗效果 - - + img_fg = (img_fg * (mask_mo / 255) * (gray_mo / 255)).astype(np.uint8) # 当sketch 图像为灰色时(非纯白) , 印花*灰度图像会导致印花在sketch上颜色变暗 result['final_image'] = cv2.add(img_bg, img_fg) canvas = np.full_like(result['final_image'], 255) From a9a596412749d59f5134d5eff2dc768cb4dec57a Mon Sep 17 00:00:00 2001 From: zhh Date: Mon, 22 Sep 2025 11:16:37 +0800 Subject: [PATCH 15/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20=20=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:?= =?UTF-8?q?=20:=20refactor=EF=BC=88=E9=87=8D=E6=9E=84=EF=BC=89:=20test(?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/pipeline/print_painting.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/service/design_fast/pipeline/print_painting.py b/app/service/design_fast/pipeline/print_painting.py index d2ef1b7..c77867c 100644 --- a/app/service/design_fast/pipeline/print_painting.py +++ b/app/service/design_fast/pipeline/print_painting.py @@ -151,7 +151,8 @@ class PrintPainting: img_bg = cv2.bitwise_and(result['pattern_image'], result['pattern_image'], mask=cv2.bitwise_not(print_mask)) mask_mo = np.expand_dims(print_mask, axis=2).repeat(3, axis=2) gray_mo = np.expand_dims(result['gray'], axis=2).repeat(3, axis=2) - img_fg = (img_fg * (mask_mo / 255) * (gray_mo / 255)).astype(np.uint8) # 当sketch 图像为灰色时(非纯白) , 印花*灰度图像会导致印花在sketch上颜色变暗 + # img_fg = (img_fg * (mask_mo / 255) * (gray_mo / 255)).astype(np.uint8) # 当sketch 图像为灰色时(非纯白) , 印花*灰度图像会导致印花在sketch上颜色变暗 + img_fg = (img_fg * (mask_mo / 255) ).astype(np.uint8) # 不过灰度图像 result['final_image'] = cv2.add(img_bg, img_fg) canvas = np.full_like(result['final_image'], 255) From 79865d9a96201a11204cf82acbd43bc899e51576 Mon Sep 17 00:00:00 2001 From: zhh Date: Mon, 22 Sep 2025 11:17:59 +0800 Subject: [PATCH 16/16] =?UTF-8?q?feat=EF=BC=88=E6=96=B0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=89:=20=20=20fix=EF=BC=88=E4=BF=AE=E5=A4=8Dbug=EF=BC=89:?= =?UTF-8?q?=20:=20refactor=EF=BC=88=E9=87=8D=E6=9E=84=EF=BC=89:=20test(?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/pipeline/print_painting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/service/design_fast/pipeline/print_painting.py b/app/service/design_fast/pipeline/print_painting.py index c77867c..b9bebfc 100644 --- a/app/service/design_fast/pipeline/print_painting.py +++ b/app/service/design_fast/pipeline/print_painting.py @@ -151,8 +151,8 @@ class PrintPainting: img_bg = cv2.bitwise_and(result['pattern_image'], result['pattern_image'], mask=cv2.bitwise_not(print_mask)) mask_mo = np.expand_dims(print_mask, axis=2).repeat(3, axis=2) gray_mo = np.expand_dims(result['gray'], axis=2).repeat(3, axis=2) - # img_fg = (img_fg * (mask_mo / 255) * (gray_mo / 255)).astype(np.uint8) # 当sketch 图像为灰色时(非纯白) , 印花*灰度图像会导致印花在sketch上颜色变暗 - img_fg = (img_fg * (mask_mo / 255) ).astype(np.uint8) # 不过灰度图像 + img_fg = (img_fg * (mask_mo / 255) * (gray_mo / 255)).astype(np.uint8) # 当sketch 图像为灰色时(非纯白) , 印花*灰度图像会导致印花在sketch上颜色变暗 + # img_fg = (img_fg * (mask_mo / 255) ).astype(np.uint8) # 不过灰度图像 result['final_image'] = cv2.add(img_bg, img_fg) canvas = np.full_like(result['final_image'], 255)