Boolean
Boolean

Reputation: 14664

Compare images in C# .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.

Any suggestions?

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?

Upvotes: 2

Views: 3633

Answers (3)

Alistair Evans
Alistair Evans

Reputation: 36473

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.

Edit: 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.

Upvotes: 5

Rich
Rich

Reputation: 15767

You should try to normalise the rotation of the images first. One way to do this is to place markers on the page which can be lined up (a black square in each corner of the page is what I have seen used before) to ensure that the page's rotation is correct before you try to identify the signatures.

Upvotes: 0

t0mm13b
t0mm13b

Reputation: 34592

Maybe the quickest way is to perform an MD5 Hash on the byte stream of the image and compare the results? Look here for further info on this.

Hope this helps, Best regards, Tom.

Upvotes: -1

Related Questions