Home

Awesome

Document Image Skew Estimation

pypi package CircleCI Codacy Badge Codacy Badge Downloads example workflow example workflow example workflow example workflow PWC

Cover Image

Table of Contents

<small><i><a href='http://ecotrust-canada.github.io/markdown-toc/'>Table of contents generated with markdown-toc</a></i></small>

Installation

pip

pip install jdeskew

How-to-use

using python

from jdeskew.estimator import get_angle
angle = get_angle(image)

from jdeskew.utility import rotate
output_image = rotate(image, angle)

Docker

https://hub.docker.com/r/phamquiluan/jdeskew/tags

# build 
DOCKER_BUILDKIT=1 docker build -t jdeskew .

# run
docker run -p 8000:80 jdeskew

# test
curl -v -F file=@sample.png localhost:8000/predict

using cog

https://github.com/replicate/cog

cog build --debug
cog predict -i input=@skew.png

# Output:
# Running prediction...
# {
#   "angle": -0.12520868113522532
# }

Download Paper

Link1: https://ieeexplore.ieee.org/document/9897910

Link2: https://www.researchgate.net/publication/364320913_ADAPTIVE_RADIAL_PROJECTION_ON_FOURIER_MAGNITUDE_SPECTRUM_FOR_DOCUMENT_IMAGE_SKEW_ESTIMATION

Performance Comparison on DISE 2021

CE: Correct Estimation rate

WE: Worst Error

AEDTOP80CEWE
FredsDeskew10.820.090.54109
PypiDeskew16.590.240.2141
Koo, Hyung Il et al.0.220.090.489.43
CMC-MSU0.270.110.4323.2
LRDE-EPITA-a0.140.060.6610.61
Our (1024)0.110.070.671.13
Our (1500)0.090.050.781.13
Our (2048)0.080.040.841.13
Our (3072)0.070.040.861.13
Our (4096)0.080.040.831.18

DISE 2021 Dataset

This datasets are built upon three other datasets: DISEC 2013, RVL-CDIP, RDCL 2017. So I urge you to respect their LICENSE.

Dataset NameURL
DISE 2021 (45 degree)https://drive.google.com/file/d/1a-a6aOqdsghjeHGLnCLsDs7NoJIus-Pw/view?usp=sharing
DISE 2021 (15 degree)https://drive.google.com/file/d/1BLiuu-j28dbuPFi4n3C0KuV6vXGmB0qS/view?usp=sharing

Can also download from Zenodo: https://zenodo.org/records/12570649

Reproducibility and Evaluation Code

Check the reproduce.ipynb file

Citation

L. Pham, H. Hoang, X.T. Mai, T. A. Tran, "Adaptive Radial Projection on Fourier Magnitude Spectrum for Document Image Skew Estimation", ICIP, 2022.

@inproceedings{pham2021dise,
  title={Adaptive Radial Projection on Fourier Magnitude Spectrum for Document Image Skew Estimation},
  author={Luan Pham, Hao Hoang, Toan Mai, and Tuan Anh Tran},
  booktitle={2022 29th International Conference on Image Processing (ICIP)},
  year={2022},
  organization={IEEE}
}

Star History

Star History Chart