Git Product home page Git Product logo

perspective-transformation's Introduction

Perspective Transformation using Line Detector and Optimization

Thien Do-Tieu

Overview

This is the Python implementation of paper for perspective transformation. By using line detector, this approach creates a loss function which contains information of tilt angle of vertical and horizontal lines, and an optimization algorithm tries to minimize loss value, simultaneously update rotate angles in perspective matrix. In this implementation, I used Gradient Descent instead of Levenberg–Marquardt algorithm

Installation

Install line detector package for python 3

pip install pylsd
pip install ocrd-fork-pylsd

Result

Image after rendering

First result

The result after cropping

First result

Reference

Rectification of planar targets using line segments

Perspective transform opencv

perspective-transformation's People

Contributors

dotieuthien avatar vgabby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

perspective-transformation's Issues

Test images from the paper.

Hello Thien Do-Tieu, thanks for your code, very impressive!
But when I try to test the images from the paper, the results are quite strange. As shown below:

Left: input   Right: output (before crop)
5 out4
test9out9
I'm not sure if you have found this and do you know how to solve it? Thanks!

Btw, personally I think line136 of rectification.py should be:
w = (u1[0] / u1[2] - v1[0] / v1[2]) ** 2 + (u1[1] / u1[2] - v1[1] / v1[2]) ** 2
(just based on my personal understanding of Equations 14 and 15 in the paper. so forgive me if I misunderstood it.)
But after I changing this line, it almost have no influence to the results.

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.