jdeskew 0.2.1__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jdeskew-0.2.3/.circleci/config.yml +60 -0
- jdeskew-0.2.3/.dockerignore +1 -0
- jdeskew-0.2.3/.flake8 +6 -0
- jdeskew-0.2.3/.github/workflows/codeql-analysis.yml +71 -0
- jdeskew-0.2.3/.github/workflows/dependency-review.yml +20 -0
- jdeskew-0.2.3/.github/workflows/docker-build-and-push.yml +38 -0
- jdeskew-0.2.3/.github/workflows/greetings.yml +16 -0
- jdeskew-0.2.3/.github/workflows/label.yml +21 -0
- jdeskew-0.2.3/.github/workflows/python-package.yml +39 -0
- jdeskew-0.2.3/.github/workflows/python-publish.yml +38 -0
- jdeskew-0.2.3/.github/workflows/stale.yml +26 -0
- jdeskew-0.2.3/.gitignore +7 -0
- jdeskew-0.2.3/.pre-commit-config.yaml +44 -0
- jdeskew-0.2.3/Dockerfile +16 -0
- {jdeskew-0.2.1/jdeskew.egg-info → jdeskew-0.2.3}/PKG-INFO +43 -6
- jdeskew-0.2.1/PKG-INFO → jdeskew-0.2.3/README.md +8 -12
- jdeskew-0.2.3/cog.yaml +12 -0
- jdeskew-0.2.3/estimator.py +18 -0
- jdeskew-0.2.3/jdeskew/__init__.py +1 -0
- {jdeskew-0.2.1 → jdeskew-0.2.3}/jdeskew/utility.py +5 -3
- jdeskew-0.2.1/README.md → jdeskew-0.2.3/jdeskew.egg-info/PKG-INFO +49 -2
- jdeskew-0.2.3/jdeskew.egg-info/SOURCES.txt +32 -0
- {jdeskew-0.2.1 → jdeskew-0.2.3}/jdeskew.egg-info/requires.txt +1 -1
- jdeskew-0.2.3/main.py +23 -0
- jdeskew-0.2.3/pyproject.toml +67 -0
- jdeskew-0.2.3/reproduce.ipynb +714 -0
- jdeskew-0.2.3/setup.py +4 -0
- jdeskew-0.2.3/tests/test.png +0 -0
- jdeskew-0.2.3/tests/test.py +33 -0
- jdeskew-0.2.1/jdeskew/__init__.py +0 -2
- jdeskew-0.2.1/jdeskew/version.py +0 -1
- jdeskew-0.2.1/jdeskew.egg-info/SOURCES.txt +0 -13
- jdeskew-0.2.1/pyproject.toml +0 -21
- jdeskew-0.2.1/setup.py +0 -49
- {jdeskew-0.2.1 → jdeskew-0.2.3}/LICENSE +0 -0
- {jdeskew-0.2.1 → jdeskew-0.2.3}/jdeskew/estimator.py +0 -0
- {jdeskew-0.2.1 → jdeskew-0.2.3}/jdeskew.egg-info/dependency_links.txt +0 -0
- {jdeskew-0.2.1 → jdeskew-0.2.3}/jdeskew.egg-info/top_level.txt +0 -0
- {jdeskew-0.2.1 → jdeskew-0.2.3}/setup.cfg +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
version: 2.1
|
|
2
|
+
|
|
3
|
+
orbs:
|
|
4
|
+
python: circleci/python@1.2
|
|
5
|
+
|
|
6
|
+
executors:
|
|
7
|
+
my-executor:
|
|
8
|
+
docker:
|
|
9
|
+
- image: cimg/python:3.9
|
|
10
|
+
environment:
|
|
11
|
+
TZ: "Australia/Melbourne"
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build-and-test:
|
|
15
|
+
executor: my-executor
|
|
16
|
+
steps:
|
|
17
|
+
- checkout
|
|
18
|
+
- run:
|
|
19
|
+
name: "Install prerequisites"
|
|
20
|
+
command: sudo apt-get update -y
|
|
21
|
+
- run:
|
|
22
|
+
name: "Build JDeskew"
|
|
23
|
+
command: |
|
|
24
|
+
pip install -U pip
|
|
25
|
+
pip install -e .[dev]
|
|
26
|
+
- run:
|
|
27
|
+
name: "Run test"
|
|
28
|
+
command: |
|
|
29
|
+
coverage run -m pytest tests/test.py
|
|
30
|
+
coverage report -i
|
|
31
|
+
coverage xml -i
|
|
32
|
+
- persist_to_workspace:
|
|
33
|
+
root: ~/project
|
|
34
|
+
paths:
|
|
35
|
+
- coverage.xml
|
|
36
|
+
upload-coverage:
|
|
37
|
+
executor: my-executor
|
|
38
|
+
steps:
|
|
39
|
+
- attach_workspace:
|
|
40
|
+
at: ~/project
|
|
41
|
+
- run:
|
|
42
|
+
name: "Upload coverage"
|
|
43
|
+
command: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml
|
|
44
|
+
|
|
45
|
+
workflows:
|
|
46
|
+
main-flow:
|
|
47
|
+
jobs:
|
|
48
|
+
- build-and-test
|
|
49
|
+
- upload-coverage:
|
|
50
|
+
requires:
|
|
51
|
+
- build-and-test
|
|
52
|
+
build-daily:
|
|
53
|
+
triggers:
|
|
54
|
+
- schedule:
|
|
55
|
+
cron: "55 3 * * *"
|
|
56
|
+
filters:
|
|
57
|
+
branches:
|
|
58
|
+
only: master
|
|
59
|
+
jobs:
|
|
60
|
+
- build-and-test
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
env
|
jdeskew-0.2.3/.flake8
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [master]
|
|
17
|
+
pull_request:
|
|
18
|
+
# The branches below must be a subset of the branches above
|
|
19
|
+
branches: [master]
|
|
20
|
+
schedule:
|
|
21
|
+
- cron: "22 15 * * 2"
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
analyze:
|
|
25
|
+
name: Analyze
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
actions: read
|
|
29
|
+
contents: read
|
|
30
|
+
security-events: write
|
|
31
|
+
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
language: ["python"]
|
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
37
|
+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
|
38
|
+
|
|
39
|
+
steps:
|
|
40
|
+
- name: Checkout repository
|
|
41
|
+
uses: actions/checkout@v3
|
|
42
|
+
|
|
43
|
+
# Initializes the CodeQL tools for scanning.
|
|
44
|
+
- name: Initialize CodeQL
|
|
45
|
+
uses: github/codeql-action/init@v2
|
|
46
|
+
with:
|
|
47
|
+
languages: ${{ matrix.language }}
|
|
48
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
49
|
+
# By default, queries listed here will override any specified in a config file.
|
|
50
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
51
|
+
|
|
52
|
+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
53
|
+
# queries: security-extended,security-and-quality
|
|
54
|
+
|
|
55
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
56
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
57
|
+
- name: Autobuild
|
|
58
|
+
uses: github/codeql-action/autobuild@v2
|
|
59
|
+
|
|
60
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
61
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
62
|
+
|
|
63
|
+
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
|
64
|
+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
|
65
|
+
|
|
66
|
+
# - run: |
|
|
67
|
+
# echo "Run, Build Application using script"
|
|
68
|
+
# ./location_of_script_within_repo/buildscript.sh
|
|
69
|
+
|
|
70
|
+
- name: Perform CodeQL Analysis
|
|
71
|
+
uses: github/codeql-action/analyze@v2
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Dependency Review Action
|
|
2
|
+
#
|
|
3
|
+
# This Action will scan dependency manifest files that change as part of a Pull Reqest, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
|
|
4
|
+
#
|
|
5
|
+
# Source repository: https://github.com/actions/dependency-review-action
|
|
6
|
+
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
|
|
7
|
+
name: "Dependency Review"
|
|
8
|
+
on: [pull_request]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
dependency-review:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: "Checkout Repository"
|
|
18
|
+
uses: actions/checkout@v3
|
|
19
|
+
- name: "Dependency Review"
|
|
20
|
+
uses: actions/dependency-review-action@v1
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
|
|
6
|
+
name: Publish Docker image
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
release:
|
|
10
|
+
types: [published]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
push_to_registry:
|
|
14
|
+
name: Push Docker image to Docker Hub
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: Check out the repo
|
|
18
|
+
uses: actions/checkout@v3
|
|
19
|
+
|
|
20
|
+
- name: Log in to Docker Hub
|
|
21
|
+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
|
22
|
+
with:
|
|
23
|
+
username: ${{ secrets.DOCKER_USERNAME }}
|
|
24
|
+
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
25
|
+
|
|
26
|
+
- name: Extract metadata (tags, labels) for Docker
|
|
27
|
+
id: meta
|
|
28
|
+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
|
29
|
+
with:
|
|
30
|
+
images: phamquiluan/jdeskew
|
|
31
|
+
|
|
32
|
+
- name: Build and push Docker image
|
|
33
|
+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
|
34
|
+
with:
|
|
35
|
+
context: .
|
|
36
|
+
push: true
|
|
37
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
38
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Greetings
|
|
2
|
+
|
|
3
|
+
on: [pull_request_target, issues]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
greeting:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
permissions:
|
|
9
|
+
issues: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/first-interaction@v1
|
|
13
|
+
with:
|
|
14
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
15
|
+
issue-message: "Message that will be displayed on users first issue"
|
|
16
|
+
pr-message: "Message that will be displayed on users first pull request"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# This workflow will triage pull requests and apply a label based on the
|
|
2
|
+
# paths that are modified in the pull request.
|
|
3
|
+
#
|
|
4
|
+
# To use this workflow, you will need to set up a .github/labeler.yml
|
|
5
|
+
# file with configuration. For more information, see:
|
|
6
|
+
# https://github.com/actions/labeler
|
|
7
|
+
|
|
8
|
+
name: Labeler
|
|
9
|
+
on: [pull_request]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
label:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
pull-requests: write
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/labeler@v4
|
|
20
|
+
with:
|
|
21
|
+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
3
|
+
|
|
4
|
+
name: Python package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [master]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [master]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v3
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
uses: actions/setup-python@v3
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: |
|
|
28
|
+
python -m pip install --upgrade pip
|
|
29
|
+
python -m pip install flake8 pytest
|
|
30
|
+
python -m pip install -e .[dev]
|
|
31
|
+
- name: Lint with flake8
|
|
32
|
+
run: |
|
|
33
|
+
# stop the build if there are Python syntax errors or undefined names
|
|
34
|
+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
35
|
+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
|
36
|
+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
37
|
+
- name: Test with pytest
|
|
38
|
+
run: |
|
|
39
|
+
pytest -n auto tests/test.py
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# This workflow will upload a Python Package using Twine when a release is created
|
|
2
|
+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
|
3
|
+
|
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
+
# They are provided by a third-party and are governed by
|
|
6
|
+
# separate terms of service, privacy policy, and support
|
|
7
|
+
# documentation.
|
|
8
|
+
|
|
9
|
+
name: Upload Python Package
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
deploy:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v3
|
|
24
|
+
- name: Set up Python
|
|
25
|
+
uses: actions/setup-python@v3
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.9"
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: |
|
|
30
|
+
python -m pip install --upgrade pip
|
|
31
|
+
pip install build
|
|
32
|
+
- name: Build package
|
|
33
|
+
run: python -m build
|
|
34
|
+
- name: Publish package
|
|
35
|
+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
|
|
36
|
+
with:
|
|
37
|
+
user: __token__
|
|
38
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
|
|
2
|
+
#
|
|
3
|
+
# You can adjust the behavior by modifying this file.
|
|
4
|
+
# For more information, see:
|
|
5
|
+
# https://github.com/actions/stale
|
|
6
|
+
name: Mark stale issues and pull requests
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
schedule:
|
|
10
|
+
- cron: "21 0 * * *"
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
stale:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
permissions:
|
|
16
|
+
issues: write
|
|
17
|
+
pull-requests: write
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/stale@v5
|
|
21
|
+
with:
|
|
22
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
23
|
+
stale-issue-message: "Stale issue message"
|
|
24
|
+
stale-pr-message: "Stale pull request message"
|
|
25
|
+
stale-issue-label: "no-issue-activity"
|
|
26
|
+
stale-pr-label: "no-pr-activity"
|
jdeskew-0.2.3/.gitignore
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v4.3.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: check-yaml
|
|
6
|
+
- id: check-toml
|
|
7
|
+
- id: end-of-file-fixer
|
|
8
|
+
- id: trailing-whitespace
|
|
9
|
+
- id: detect-aws-credentials
|
|
10
|
+
args: ["--allow-missing-credentials"]
|
|
11
|
+
- id: detect-private-key
|
|
12
|
+
- id: end-of-file-fixer
|
|
13
|
+
- id: check-added-large-files
|
|
14
|
+
- repo: https://github.com/ambv/black
|
|
15
|
+
rev: 22.3.0
|
|
16
|
+
hooks:
|
|
17
|
+
- id: black
|
|
18
|
+
language_version: python3.7
|
|
19
|
+
- repo: https://github.com/pycqa/isort
|
|
20
|
+
rev: 5.8.0
|
|
21
|
+
hooks:
|
|
22
|
+
- id: isort
|
|
23
|
+
args: ["--profile", "black"]
|
|
24
|
+
- repo: https://gitlab.com/pycqa/flake8
|
|
25
|
+
rev: 3.9.1
|
|
26
|
+
hooks:
|
|
27
|
+
- id: flake8
|
|
28
|
+
- repo: https://github.com/myint/autoflake
|
|
29
|
+
rev: v1.4
|
|
30
|
+
hooks:
|
|
31
|
+
- id: autoflake
|
|
32
|
+
args:
|
|
33
|
+
[
|
|
34
|
+
"--in-place",
|
|
35
|
+
"--remove-unused-variables",
|
|
36
|
+
"--remove-all-unused-imports",
|
|
37
|
+
"--ignore-init-module-imports",
|
|
38
|
+
"--exclude=tests/*",
|
|
39
|
+
]
|
|
40
|
+
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
41
|
+
rev: v2.7.1
|
|
42
|
+
hooks:
|
|
43
|
+
- id: prettier
|
|
44
|
+
types_or: [markdown, yaml]
|
jdeskew-0.2.3/Dockerfile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
FROM ubuntu:20.04
|
|
2
|
+
ARG DEBIAN_FRONTEND=noninteractive
|
|
3
|
+
|
|
4
|
+
RUN apt-get update && apt-get install --no-install-recommends -y python3.8 python3.8-dev python3-pip ffmpeg\
|
|
5
|
+
&& apt-get clean \
|
|
6
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
7
|
+
|
|
8
|
+
RUN pip install pip==22.0.3
|
|
9
|
+
|
|
10
|
+
# Copy source code
|
|
11
|
+
WORKDIR /app
|
|
12
|
+
COPY . /app/
|
|
13
|
+
|
|
14
|
+
RUN pip install .[dev]
|
|
15
|
+
EXPOSE 80
|
|
16
|
+
ENTRYPOINT ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]
|
|
@@ -1,17 +1,48 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jdeskew
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Document Image Skew Estimation using Adaptive Radial Projection
|
|
5
|
-
Author: Luan Pham
|
|
6
|
-
|
|
5
|
+
Author-email: Luan Pham <phamquiluan@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2022 Luan Pham
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
7
28
|
Description-Content-Type: text/markdown
|
|
8
|
-
Provides-Extra: dev
|
|
9
29
|
License-File: LICENSE
|
|
30
|
+
Requires-Dist: numpy
|
|
31
|
+
Requires-Dist: opencv-python-headless
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: black; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest; extra == "dev"
|
|
35
|
+
Requires-Dist: coverage; extra == "dev"
|
|
36
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
38
|
+
Requires-Dist: fastapi; extra == "dev"
|
|
39
|
+
Requires-Dist: uvicorn[standard]; extra == "dev"
|
|
40
|
+
Requires-Dist: python-multipart; extra == "dev"
|
|
10
41
|
|
|
11
42
|
# Document Image Skew Estimation
|
|
12
43
|
|
|
13
|
-
[](https://pypi.org/project/jdeskew)
|
|
45
|
+
[](https://dl.circleci.com/status-badge/redirect/gh/phamquiluan/jdeskew/tree/master)
|
|
15
46
|
[](https://www.codacy.com/gh/phamquiluan/jdeskew/dashboard?utm_source=github.com&utm_medium=referral&utm_content=phamquiluan/jdeskew&utm_campaign=Badge_Coverage)
|
|
16
47
|
[](https://www.codacy.com/gh/phamquiluan/jdeskew/dashboard?utm_source=github.com&utm_medium=referral&utm_content=phamquiluan/jdeskew&utm_campaign=Badge_Grade)
|
|
17
48
|
[](https://pepy.tech/project/jdeskew)
|
|
@@ -130,6 +161,8 @@ This datasets are built upon three other datasets: DISEC 2013, RVL-CDIP, RDCL 20
|
|
|
130
161
|
| DISE 2021 (45 degree) | https://drive.google.com/file/d/1a-a6aOqdsghjeHGLnCLsDs7NoJIus-Pw/view?usp=sharing |
|
|
131
162
|
| DISE 2021 (15 degree) | https://drive.google.com/file/d/1BLiuu-j28dbuPFi4n3C0KuV6vXGmB0qS/view?usp=sharing |
|
|
132
163
|
|
|
164
|
+
Can also download from Zenodo: https://zenodo.org/records/12570649
|
|
165
|
+
|
|
133
166
|
## Reproducibility and Evaluation Code
|
|
134
167
|
|
|
135
168
|
Check the [reproduce.ipynb](reproduce.ipynb) file
|
|
@@ -147,3 +180,7 @@ L. Pham, H. Hoang, X.T. Mai, T. A. Tran, "Adaptive Radial Projection on Fourier
|
|
|
147
180
|
organization={IEEE}
|
|
148
181
|
}
|
|
149
182
|
```
|
|
183
|
+
|
|
184
|
+
## Star History
|
|
185
|
+
|
|
186
|
+
[](https://star-history.com/#phamquiluan/jdeskew&Date)
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: jdeskew
|
|
3
|
-
Version: 0.2.1
|
|
4
|
-
Summary: Document Image Skew Estimation using Adaptive Radial Projection
|
|
5
|
-
Author: Luan Pham
|
|
6
|
-
Author-email: phamquiluan@gmail.com
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
Provides-Extra: dev
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
|
|
11
1
|
# Document Image Skew Estimation
|
|
12
2
|
|
|
13
|
-
[](https://pypi.org/project/jdeskew)
|
|
4
|
+
[](https://dl.circleci.com/status-badge/redirect/gh/phamquiluan/jdeskew/tree/master)
|
|
15
5
|
[](https://www.codacy.com/gh/phamquiluan/jdeskew/dashboard?utm_source=github.com&utm_medium=referral&utm_content=phamquiluan/jdeskew&utm_campaign=Badge_Coverage)
|
|
16
6
|
[](https://www.codacy.com/gh/phamquiluan/jdeskew/dashboard?utm_source=github.com&utm_medium=referral&utm_content=phamquiluan/jdeskew&utm_campaign=Badge_Grade)
|
|
17
7
|
[](https://pepy.tech/project/jdeskew)
|
|
@@ -130,6 +120,8 @@ This datasets are built upon three other datasets: DISEC 2013, RVL-CDIP, RDCL 20
|
|
|
130
120
|
| DISE 2021 (45 degree) | https://drive.google.com/file/d/1a-a6aOqdsghjeHGLnCLsDs7NoJIus-Pw/view?usp=sharing |
|
|
131
121
|
| DISE 2021 (15 degree) | https://drive.google.com/file/d/1BLiuu-j28dbuPFi4n3C0KuV6vXGmB0qS/view?usp=sharing |
|
|
132
122
|
|
|
123
|
+
Can also download from Zenodo: https://zenodo.org/records/12570649
|
|
124
|
+
|
|
133
125
|
## Reproducibility and Evaluation Code
|
|
134
126
|
|
|
135
127
|
Check the [reproduce.ipynb](reproduce.ipynb) file
|
|
@@ -147,3 +139,7 @@ L. Pham, H. Hoang, X.T. Mai, T. A. Tran, "Adaptive Radial Projection on Fourier
|
|
|
147
139
|
organization={IEEE}
|
|
148
140
|
}
|
|
149
141
|
```
|
|
142
|
+
|
|
143
|
+
## Star History
|
|
144
|
+
|
|
145
|
+
[](https://star-history.com/#phamquiluan/jdeskew&Date)
|
jdeskew-0.2.3/cog.yaml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
build:
|
|
2
|
+
gpu: false
|
|
3
|
+
run:
|
|
4
|
+
- "apt-get update -y"
|
|
5
|
+
system_packages:
|
|
6
|
+
- "ffmpeg"
|
|
7
|
+
python_version: "3.8"
|
|
8
|
+
python_packages:
|
|
9
|
+
- "pillow==9.1.0"
|
|
10
|
+
pre_install:
|
|
11
|
+
- "git clone https://github.com/phamquiluan/jdeskew.git && cd jdeskew && pip install .[dev]"
|
|
12
|
+
predict: "estimator.py:Estimator"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Estimator for cog users."""
|
|
2
|
+
from typing import Dict
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
from cog import BasePredictor, Input, Path
|
|
6
|
+
from PIL import Image
|
|
7
|
+
|
|
8
|
+
from jdeskew.estimator import get_angle
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Estimator(BasePredictor):
|
|
12
|
+
"""Cog estimator."""
|
|
13
|
+
|
|
14
|
+
def predict(self, input_path: Path = Input()) -> Dict:
|
|
15
|
+
"""Run a single prediction on the model."""
|
|
16
|
+
im = np.array(Image.open(str(input_path)))
|
|
17
|
+
angle = get_angle(im)
|
|
18
|
+
return {"angle": angle}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""JDeskew Packages."""
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import cv2
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
def rotate(image, angle, resize=True, border_mode=None, border_value=None):
|
|
5
|
+
def rotate(image, angle, resize=True, border_mode=None, border_value=None, flags=None):
|
|
6
6
|
"""Rotate input image respect to a given angle.
|
|
7
7
|
|
|
8
8
|
Params:
|
|
@@ -13,6 +13,9 @@ def rotate(image, angle, resize=True, border_mode=None, border_value=None):
|
|
|
13
13
|
"""
|
|
14
14
|
if border_mode is None:
|
|
15
15
|
border_mode = cv2.BORDER_CONSTANT
|
|
16
|
+
if flags is None:
|
|
17
|
+
# flags=cv2.INTER_NEAREST
|
|
18
|
+
flags = cv2.INTER_LINEAR
|
|
16
19
|
|
|
17
20
|
h, w = image.shape[:2]
|
|
18
21
|
M = cv2.getRotationMatrix2D(center=(w // 2, h // 2), angle=angle, scale=1.0)
|
|
@@ -20,8 +23,7 @@ def rotate(image, angle, resize=True, border_mode=None, border_value=None):
|
|
|
20
23
|
src=image,
|
|
21
24
|
M=M,
|
|
22
25
|
dsize=(w, h),
|
|
23
|
-
|
|
24
|
-
flags=cv2.INTER_NEAREST,
|
|
26
|
+
flags=flags,
|
|
25
27
|
borderMode=border_mode,
|
|
26
28
|
borderValue=None if border_mode == cv2.BORDER_REPLICATE else border_value,
|
|
27
29
|
)
|
|
@@ -1,7 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: jdeskew
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: Document Image Skew Estimation using Adaptive Radial Projection
|
|
5
|
+
Author-email: Luan Pham <phamquiluan@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2022 Luan Pham
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: numpy
|
|
31
|
+
Requires-Dist: opencv-python-headless
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: black; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest; extra == "dev"
|
|
35
|
+
Requires-Dist: coverage; extra == "dev"
|
|
36
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
38
|
+
Requires-Dist: fastapi; extra == "dev"
|
|
39
|
+
Requires-Dist: uvicorn[standard]; extra == "dev"
|
|
40
|
+
Requires-Dist: python-multipart; extra == "dev"
|
|
41
|
+
|
|
1
42
|
# Document Image Skew Estimation
|
|
2
43
|
|
|
3
|
-
[](https://pypi.org/project/jdeskew)
|
|
45
|
+
[](https://dl.circleci.com/status-badge/redirect/gh/phamquiluan/jdeskew/tree/master)
|
|
5
46
|
[](https://www.codacy.com/gh/phamquiluan/jdeskew/dashboard?utm_source=github.com&utm_medium=referral&utm_content=phamquiluan/jdeskew&utm_campaign=Badge_Coverage)
|
|
6
47
|
[](https://www.codacy.com/gh/phamquiluan/jdeskew/dashboard?utm_source=github.com&utm_medium=referral&utm_content=phamquiluan/jdeskew&utm_campaign=Badge_Grade)
|
|
7
48
|
[](https://pepy.tech/project/jdeskew)
|
|
@@ -120,6 +161,8 @@ This datasets are built upon three other datasets: DISEC 2013, RVL-CDIP, RDCL 20
|
|
|
120
161
|
| DISE 2021 (45 degree) | https://drive.google.com/file/d/1a-a6aOqdsghjeHGLnCLsDs7NoJIus-Pw/view?usp=sharing |
|
|
121
162
|
| DISE 2021 (15 degree) | https://drive.google.com/file/d/1BLiuu-j28dbuPFi4n3C0KuV6vXGmB0qS/view?usp=sharing |
|
|
122
163
|
|
|
164
|
+
Can also download from Zenodo: https://zenodo.org/records/12570649
|
|
165
|
+
|
|
123
166
|
## Reproducibility and Evaluation Code
|
|
124
167
|
|
|
125
168
|
Check the [reproduce.ipynb](reproduce.ipynb) file
|
|
@@ -137,3 +180,7 @@ L. Pham, H. Hoang, X.T. Mai, T. A. Tran, "Adaptive Radial Projection on Fourier
|
|
|
137
180
|
organization={IEEE}
|
|
138
181
|
}
|
|
139
182
|
```
|
|
183
|
+
|
|
184
|
+
## Star History
|
|
185
|
+
|
|
186
|
+
[](https://star-history.com/#phamquiluan/jdeskew&Date)
|