From c4f23e1ac3372e912160a4613bf31277cf334569 Mon Sep 17 00:00:00 2001 From: sinvo Date: Thu, 19 Mar 2026 17:20:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E6=B7=B1=E6=96=87=E5=AD=97=EF=BC=9ALU?= =?UTF-8?q?T=E5=88=86=E7=95=8C=E7=82=B9=E4=BB=8E180=E6=8F=90=E5=88=B0200?= =?UTF-8?q?=EF=BC=8C=E6=96=87=E5=AD=97=E6=98=A0=E5=B0=84=E4=B8=8A=E9=99=90?= =?UTF-8?q?=E4=BB=8E80=E9=99=8D=E5=88=B050?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- CamScanner.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/CamScanner.cs b/CamScanner.cs index 1e87a13..a394535 100644 --- a/CamScanner.cs +++ b/CamScanner.cs @@ -367,22 +367,20 @@ public static class DocumentScanner Marshal.Copy(resultData, 0, normU8.Data, resultData.Length); // --- d: 非线性对比度增强(让文字更黑)--- - // 除法归一化后文字大约在 180-230 范围(偏亮),需要拉黑 + // 除法归一化后文字大约在 180-240 范围,需要拉黑 // 用 LUT 做分段映射: - // 0-180: 线性映射到 0-80(文字区域压暗) - // 180-255: 线性映射到 80-255(背景区域保持亮) + // 0-200: 线性映射到 0-50(文字区域强力压暗) + // 200-255: 线性映射到 50-255(背景区域拉亮) byte[] lut = new byte[256]; for (int i = 0; i < 256; i++) { - if (i <= 180) + if (i <= 200) { - // 文字区域:压暗 - lut[i] = (byte)(i * 80 / 180); + lut[i] = (byte)(i * 50 / 200); } else { - // 背景区域:拉亮 - lut[i] = (byte)(80 + (i - 180) * 175 / 75); + lut[i] = (byte)(50 + (i - 200) * 205 / 55); } if (lut[i] > 255) lut[i] = 255; }