Skip to content

scoutant/signature-detect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple photo signature watermark detection using PyTorch CRAFT text detector

photo with signature

The photo is obviously signed. But how to automate the detection?

Text detection

times square

Yes this photo of Times Square does include multiple texts. Only text in the wild. No signature was added.

CRAFT detector

Detecting texts is a challenge. Following paper does provide a consistent approach : Character Region Awareness for Text Detection, 2019, https://arxiv.org/abs/1904.01941

For Python we can use this PyTorch implementation : https://github.com/fcakyon/craft-text-detector

Installation cannot be simpler :

pip install craft-text-detector imageio

How to use? Just create the engine:

craft = Craft(output_dir='output', crop_type="box")

And run the detection, providing a batch of images :

result = craft.detect_text([ image])

The result holds a list of bounding boxes for the detected text regions for every image.

Telling signature text from text in the wild

You may come up with a more advanced solution. For the moment we can use a simple region-based decision.

We state that a signature most often is located in a corner. Or at very top or bottom of the image.

You may refer to Where do I place my watermark.

detection

We can traverse the list of detected text bounding boxes. And if any of them happen to be completely inside the mask we consider it to be a signature...

Run the demo tests

python -m unittest craft_test.py

About

Simple photo signature watermark detection using PyTorch CRAFT text detector

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages