From c51bbc18e8150ec25218fcba40d91934f9386682 Mon Sep 17 00:00:00 2001 From: sinvo Date: Thu, 19 Mar 2026 17:23:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E5=8A=A0=E6=B7=B1=E6=96=87?= =?UTF-8?q?=E5=AD=97=EF=BC=9A=E5=88=86=E7=95=8C=E7=82=B9210=EF=BC=8C?= =?UTF-8?q?=E6=96=87=E5=AD=97=E6=98=A0=E5=B0=84=E4=B8=8A=E9=99=9030?= =?UTF-8?q?=EF=BC=8C=E6=8E=A5=E8=BF=91=E6=89=AB=E6=8F=8F=E5=85=A8=E8=83=BD?= =?UTF-8?q?=E7=8E=8B=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- CamScanner.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CamScanner.cs b/CamScanner.cs index a394535..122174e 100644 --- a/CamScanner.cs +++ b/CamScanner.cs @@ -367,20 +367,19 @@ public static class DocumentScanner Marshal.Copy(resultData, 0, normU8.Data, resultData.Length); // --- d: 非线性对比度增强(让文字更黑)--- - // 除法归一化后文字大约在 180-240 范围,需要拉黑 // 用 LUT 做分段映射: - // 0-200: 线性映射到 0-50(文字区域强力压暗) - // 200-255: 线性映射到 50-255(背景区域拉亮) + // 0-210: 线性映射到 0-30(文字区域强力压暗) + // 210-255: 线性映射到 30-255(背景区域拉亮) byte[] lut = new byte[256]; for (int i = 0; i < 256; i++) { - if (i <= 200) + if (i <= 210) { - lut[i] = (byte)(i * 50 / 200); + lut[i] = (byte)(i * 30 / 210); } else { - lut[i] = (byte)(50 + (i - 200) * 205 / 55); + lut[i] = (byte)(30 + (i - 210) * 225 / 45); } if (lut[i] > 255) lut[i] = 255; }