From e5aadc2c40aad68eda87732487f0eb75aafd5f2d Mon Sep 17 00:00:00 2001 From: kayorl Date: Fri, 7 Aug 2026 21:08:41 +0800 Subject: [PATCH] fix(smart_color_match): add float32 type conversion to clipped LAB data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复颜色转换后未指定数据类型导致的潜在类型不匹配问题,为裁剪后的LAB数组添加float32类型转换 --- smart_color_match.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smart_color_match.py b/smart_color_match.py index 330fb0b..fe8ef17 100644 --- a/smart_color_match.py +++ b/smart_color_match.py @@ -124,7 +124,7 @@ class SmartColorMatchAdvanced: final_lab = corrected_low + gen_lab_high # 9. 转换回 RGB 并处理溢出边界 - final_lab = np.clip(final_lab, [0, -128, -128], [100, 127, 127]) + final_lab = np.clip(final_lab, [0, -128, -128], [100, 127, 127]).astype(np.float32) res_rgb = cv2.cvtColor(final_lab, cv2.COLOR_LAB2RGB) res_rgb = np.clip(res_rgb, 0.0, 1.0)