Signature Detection
A simple tool to detect if there are signatures in an image or a PDF file.
The full documentation is presented at the Github Repository.
Extra Dependencies
This tool uses Wand to convert a PDF file into images.
Wand is a ctypes-based simple ImageMagick binding for Python. You may need to install ImageMagick on your local machine.
More details are available here.
Usage
Signature_detect contains 4 classes.
- Loader
- Extractor
- Cropper
- Judger
Loader
Loader can read an image or a PDF file page by page.
It returns a list of the masks. Each mask is a numpy 2 dimensions array. Its element's value is 0 or 255.
from signature_detect.loader import Loader
loader = Loader(
low_threshold=(0, 0, 250),
high_threshold=(255, 255, 255))
masks = loader.get_masks(file_path)
Extractor
Extractor reads a mask, labels the regions in the mask, and removes both small and big regions. We consider that the signature is a region of middle size.
from signature_detect.extractor import Extractor
extractor = Extractor(
outlier_weight=3,
outlier_bias=100,
amplfier=10,
min_area_size=10)
labeled_mask = extractor.extract(mask)
Cropper
Cropper crops the regions in the labeled mask.
from signature_detect.cropper import Cropper
cropper = Cropper(
min_region_size=10000,
border_ratio=0.1)
results = cropper.run(labeled_mask)
Judger
Judger decides whether a region is a signature.
from signature_detect.judger import Judger
judger = Judger(
size_ratio=[1, 4],
pixel_ratio=[0.01, 1])
is_signed = judger.judge(result["cropped_mask"])
Dev version
If you would like to develop this package and run the tests, you can download the code and install dev environment locally.
pip install -e .[dev]
Metadata
Release files for signature-detect 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| signature-detect-0.1.4.tar.gz | 6.1 kB | Without provenance | Details for signature-detect-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| signature_detect-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for signature_detect-0.1.4-py3-none-any.whl |
Total release size: 19.7 kB
Release files / signature-detect-0.1.4.tar.gz
| Download URL | signature-detect-0.1.4.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bf25cf3695a338c79b3c4ec17208161977477144ba9c56283d737117bc32be4
|
|
BLAKE2b-256 checksum How to use checksums |
e3621c84a233fcd915297e5979091d57fd942b3b4d2648fcccc11df09ee7d9d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8
|
Release files / signature_detect-0.1.4-py3-none-any.whl
| Download URL | signature_detect-0.1.4-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52c2775ff0415619243afc0b943acbfcdc86be3f9999582cd6adae3d80d7dc2a
|
|
BLAKE2b-256 checksum How to use checksums |
8f7996c9b3f4eef8d33bf18bf44e76f1f35d8ca6115ad54b71237ae580eee11e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8
|
Security for signature-detect 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.