使用 TWAIN 扫描的图像计算的准确性
我正在使用 TWAIN 库来扫描灰度图像。然后,我以编程方式调整扫描图像中的每个像素,以具有不同的白色和黑色端点。因此,颜色值小于黑点的像素将被钳位到黑点。并且颜色值大于白点的像素被钳位到白点。此外,还会推断其间的所有像素。
我的问题是我在计算中损失了质量,因为我正在计算的扫描图像每个颜色通道只有 8 位。
我要么需要某种方式来获取每个颜色通道具有更高位数的图像,要么我需要告诉扫描仪为我进行此计算。
我知道爱普生控制面板允许您指定黑白端点并进行此计算,而且看起来它没有准确性问题。所以我想知道它是否在做一些特定于爱普生硬件的事情。不幸的是我的软件需要使用通用打印机。
有谁知道解决这个问题的方法吗?
I'm using the TWAIN libraries to scan a greyscale image. I then programmatically adjust each pixel in the scanned image to have different white and black endpoints. So pixels with a colour value of less than the blackpoint are clamped to the blackpoint. And pixels with a colour value of greater than the whitepoint are clamped to the whitepoint. Also, all pixels that are inbetween are extrapolated.
My problem is that I'm losing quality in the calculation because the scanned image I'm doing the calculation on is only 8bits per colour channel.
I either need some way of acquiring the image with a higher number of bits per colour channel, or I need to tell the scanner to do this calculation for me.
I know that the Epson control panel allows you to specify black and white end points and do this calculation, and it looks like it's not having the accuracy issues. So I wonder if it's doing something specific to the Epson hardware. Unfortunately my software needs to use generic printers.
Does anyone know a way around this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
某些型号的 TWAIN 扫描仪(大多数是平板式)可以提供比 8 位/通道更深的数据。
您的代码需要将传输机制(ICAP_XFERMECH)设置为内存(TWSX_MEMORY),将像素类型(ICAP_PIXELTYPE)设置为TWPT_GRAY,然后看看是否可以将ICAP_BITDEPTH设置为16。
如果成功,您可以执行内存(又名缓冲) )图像传输,并获取16位/通道数据。我预计您会发现数据位于 10-12 高位(即样本范围为 0..65535),而低位是噪声。
您不能使用本机传输模式 (TWSX_NATIVE),因为本机图像格式(DIB 和 PICT)不支持 16 位/通道数据。您也许可以使用支持 16 位/通道数据的文件格式(例如 TIFF 或 JFIF)的文件传输模式:您只需尝试扫描仪即可。
我刚刚用桌上的 Epson Perfection V100 Photo 完成了此操作,我确信其他 Epson 也支持此功能,也许所有 Perfection 系列都支持。
请参阅:Twister Report archive
是的,这就是它适用的原因当您在扫描仪的 UI 中进行对比度调整时,8 位扫描是扫描仪通过调整放大器中的增益来调整对比度 - 因此在模拟域中工作。 (实际上,无限位/通道;-)
您可以利用该电路:大多数平板将允许您设置 ICAP_SHADOW、ICAP_HIGHLIGHT 和 ICAP_CONTRAST - 这与在扫描仪 UI 中设置黑电平、白电平和对比度具有相同的效果。然后你会调整模拟信号,你会得到密集的 8 位
Some models of TWAIN scanner - mostly they are flatbeds - can deliver data deeper than 8 bits/channel.
Your code needs to set the transfer mechanism (ICAP_XFERMECH) to memory (TWSX_MEMORY), set the pixel type (ICAP_PIXELTYPE) to TWPT_GRAY, then see if you can set ICAP_BITDEPTH to 16.
If that succeeds, you can then do a memory (AKA buffered) image transfer, and get 16-bit/channel data. I expect you'll find that the data is in the 10-12 upper bits (i.e. the sample range is 0..65535) and the low bits are noise.
You can't use native transfer mode (TWSX_NATIVE) because the native image formats (DIB and PICT) don't support 16-bit/channel data. You might be able to use file transfer mode with a file format that supports 16-bit/channel data, like TIFF or JFIF: You'd just have to experiment with the scanner.
I just did this with an Epson Perfection V100 Photo I have on my desk, I'm sure other Epsons support this, maybe all the Perfection series.
See: Twister Report archive
And yes, the reason this works well with 8-bit scans when you do contrast adjustments in the scanner's UI is that the scanner is adjusting the contrast by tweaking the gain in an amplifier - so working in the analog domain. (Effectively, infinite bits/channel ;-)
You could exploit that circuitry: Most flatbeds will let you set ICAP_SHADOW, ICAP_HIGHLIGHT and ICAP_CONTRAST - which has the same effect as setting the black level, white level and contrast in the scanner UI. Then you'd be adjusting the analog signal, and you'll get dense 8-bit histograms.