GithubHelp home page GithubHelp logo

mm-sam / card-rectification Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shakex/card-rectification

0.0 0.0 0.0 115.04 MB

A python-based algorithm for id-card rectification

License: Apache License 2.0

Python 100.00%

card-rectification's Introduction

ID-Card Rectification (v2.0)

example

A python-based algorithm for id-card rectification, specially optimized for China 2nd-generation id-card rectification. Given an input image which contains a card, the algorithm detects the card contour and performs perspective transformation in order to obatin the rectified card as output.

Features

  • An novel edge detection network is implemented to detect the card contour under complex background. The network is based on the RDC project and a new loss called edge-consist-loss is implemented to better impove the detection result.
  • The algorithm works well for various input shapes, the output will be finetuned as the standard format of China 2nd-generation id-card.

Requirements

  • pytorch
  • torchvision
  • opencv-python
  • scikit-image
  • imutils
  • numpy

Usage

Install

$ pip install -r requirements.txt

if you want to run the algorithm with GPU, make sure that your computer support Nivida GPU and then install cuda. The algorithm will run with GPU if cuda is available, otherwise it will run with CPU, which takes more time complexity for image processing.

Run

  1. Go to Card-Rectification/

  2. Single-image processing:$ python rectify.py [input_path] [output_path]

    • input_path: the path of input image
    • output_path: the path of output result
    • e.g. $ python rectify.py example/card1.jpg result/card1_res.png
  3. Mutiple-image processing:$ python rectify.py [input_dir] [output_dir]

    • input_dir: the directory of inputs
    • output_dir: the directory of ouputs
    • e.g. $ python rectify.py example/ result/

    the default save format is '.png'.

Unsolved situation

  • The card is incomplete or is occuluded by other objects.
  • If the card is upside down, the output will not adjust the rotation.

For any problems, please contact [email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.