Skip to content
/ docuwarp Public

Docuwarp is a Python library for unwarping documents

Notifications You must be signed in to change notification settings

pstwh/docuwarp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docuwarp

Docuwarp is a Python library for unwarping documents. It uses for inference the model from the paper "UVDoc: Neural Grid-based Document Unwarping." For more information about the paper behind this model, you can read the paper here. The GitHub repository maintained by the author is available here.

Installation

To install Docuwarp, follow these steps:

For cpu

pip install "docuwarp[cpu]"

For cuda 11.X

pip install "docuwarp[gpu]"

For cuda 12.X

pip install "docuwarp[gpu]" --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/

Usage

Command Line Interface

You can use Docuwarp from the command line by providing an image file:

docuwarp examples/1.jpg

Using in Code

You can also incorporate Docuwarp into your Python code as follows:

from PIL import Image
from docuwarp.unwarp import Unwarp

unwarp = Unwarp()
image = Image.open('examples/1.jpg')
unwarped_image = unwarp.inference(image)

If you want to use CUDA:

from PIL import Image
from docuwarp.unwarp import Unwarp

unwarp = Unwarp(providers=["CUDAExecutionProvider"])
image = Image.open('examples/1.jpg')
unwarped_image = unwarp.inference(image)

Check all execution providers here.

Example

original unwarp

Citation

@inproceedings{UVDoc,
title={{UVDoc}: Neural Grid-based Document Unwarping},
author={Floor Verhoeven and Tanguy Magne and Olga Sorkine-Hornung},
booktitle = {SIGGRAPH ASIA, Technical Papers},
year = {2023},
url={https://doi.org/10.1145/3610548.3618174}
}