fix-perspective
Computes and applies perspective correction given 4 corners
Last updated 5 years ago by bahmutov .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install fix-perspective 
SYNC missed versions from official npm registry.

fix-perspective

Computes and applies perspective correction given 4 corners

Based on the following sources:

NPM

Build status dependencies devdependencies

Given 4 starting points and 4 end points calculates transformation function (and matrix) that transforms any starting point. Usually used to remove perspective distortion.

// from, to are arrays with 4 points each (x, y)
var from = [{ 
    x: 100,
    y: 20
}, {
    x: 200,
    y: 50
}, ...];
var to = [{ 
    x: 20,
    y: 0
}, {
    x: 100,
    y: 0
}, ...];
var fixPerspective = require('fix-perspective');
var transformation = fixPerspective(from, to);
// any point in the original (FROM) coordinate system
var out = transformation(100, 60);
// out = { x: ..., y: ... };
// the transformation matrix (4x4) is available as transformation.H

Small print

Author: Gleb Bahmutov © 2015

License: MIT - do anything with the code, but don't blame uTest if it does not work.

Spread the word: tweet, star on github, etc.

Support: if you find any problems with this module, email / tweet / open issue on Github

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

1 Versions

  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (4)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |