再次加深文字:分界点210,文字映射上限30,接近扫描全能王效果
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user