在C#.NET中的图像进行比较图像、NET

2023-09-03 15:29:55 作者:?-心交朋友钱交

我有具有可以或可以不包含签名多个盒子的文档的扫描图像。我能够确定的箱子,但现在我想找出哪个箱子有签字。我试图图像与参考空白框图像进行比较。理想的情况下像素的比赛应该做的,但我的图像可以通过一些角度,这使得它很难被倾斜。我编程在.NET。

I have a scanned image of a document which has multiple boxes which may or may not contain signatures. I am able to identify the boxes, but now I want to figure out which boxes contain signatures. I tried to compare the image with the reference blank box image. Ideally pixel match should do,but my images can be tilted by some angle, which makes it tough. I am programming in .NET.

有什么建议?

编辑于1月4日: 我已要求在25月这个问题,当时提出的解决方案是检查统计黑色像素图像中的数量。这为我工作。但是,应用程序的性能现在是坏的。因为,它必须检查黑色像素20矩形100 * 1000尺寸

Edited on Jan 04: I have asked this question on Nov 25. At that time, the solution proposed was to check count the number of black pixels in the image. That worked for me. However, the performance of the application is bad now. Because, it has to check black pixels on 20 rectangles of 100*1000 size.

有没有更好的解决办法来确定一个图像是空白的?

Is there any better to solution to determine if a image is blank?

推荐答案

也许你可以总结像素匹配空白色数,然后求和的像素不匹配的空白颜色的数量。如果非空像素的数量超过一定的水平,那么假定有一个签名?从逻辑上讲,一个空框将包含几乎完全空白的像素,并且在它的签名的框将包含少了很多空白像素。

Perhaps you could sum the number of pixels matching the 'blank' colour, and then sum the number of pixels not matching the blank colour. If the number of non-blank pixels is over a certain level, then assume that there is a signature? Logically, an empty box will contain almost entirely blank pixels, and a box with a signature in it will contain a lot less blank pixels.

编辑:一个额外的点 - 你会希望有一定程度的容忍,什么是空白像素的颜色,否则有点灰尘或梯度出现在扫描会造成非-blank像素。

One extra point - you will want to have a degree of tolerance for what is a 'blank' pixel colour, otherwise a bit of dust or gradient that arose while scanning will cause a non-blank pixel.