Java library or strategy to determine if an image contains a signature

I have an image file and I need to determine if the specified area of ​​this image contains a signature. Or put it in terms of the end user: "Is this document signed?"

What I have done so far is to examine all the pixels contained in this area, calculate the average “darkness” and compare it with the reference value. If the difference in darkness exceeds a certain threshold, I believe that it is signed.

The problem with this (admittedly simplified) approach is that since the pixels of the signature itself are such a small part of the area, I have to use a very low darkness threshold, which leads to a lot of false positives. I can not distinguish a real signature from stray markings, spots, flare artifacts, etc.

To be clear ... I'm not trying to match any particular signature or set of signatures. That is, I don’t care who signed it only if it is signed.

Does anyone know of a Java library that can do this, or a better approach to this problem than what I'm doing now?

EDIT:

This is an example of the types of images that I work with. This document will be faxed to the recipient, signed and faxed. It will not be so clean that I have to look for a signature.

+7
java image-processing opencv computer-vision
source share
2 answers

I do not know any simple solutions. You can wrap queXF or write something like this in Java. This article talks about a color code algorithm for recognizing signatures.

+1
source share

This is what I consider possible (although this is not a good solution), but it can still work. This will require a bit of machine learning. I assume that your image does not contain hand-written text and its just an image.

The first thing to do is create a data set of images containing the signature, as well as those that do not. Positive samples of the data set should contain only signatures (you can study the classifier for several aspect ratios), and negative samples should contain random images with the same aspect ratio / dimension. Now you can calculate some function from these samples (HoG can be used as a function, although I do not claim that this is the best option for this application) and study the SVM for each aspect ratio.

The next step is to hide the detection window (with different proportions) throughout the image and use several SVMs that you have studied and check if any of them give a positive answer.

Although this approach may not always work, it should bring sufficient accuracy. The more data you study, the better the results will be obtained (and if you can create a good feature vector to represent your signature, this will help you again in this case)

+1
source share

All Articles