注册 | 登录

node.js - How to fix image perspective distortion and rotation with JavaScript?

itPublisher 分享于



I have some images that takes using mobile phone. Is there any JavaScript library which can straighten the photo of a paper and flatten it? For example I want to create a rectangular image without any distortion from this image.

In the other words I want to know how to fix perspective distortion and rotation with JavaScript?

For example I found below sample image from this article:

How to fix this type of image with javascript?

javascript node.js image-processing perspective distortion
  this question
asked Nov 2 '15 at 4:26 b24 877 6 20 36      canvas may have the tools required to manipulate an image - but wait, you flagged it node.js, so there is no browser goodness available - you'll need something pretty intelligent, it has to detect issues and fix them with no user interaction –  Jaromanda X Nov 2 '15 at 4:44      This is either wa-a-a-ay too broad for Stack Overflow, or you're asking for something already made that can do this which is off-topic for Stack Overflow. –  Tiny Giant Nov 2 '15 at 22:16      @JaromandaX , Yes I need a way that work without user interaction. –  b24 Nov 3 '15 at 12:13 1   Realize my algorithm on java . Calculate quaternion then rotate image. Any question - ask –  Ivan.s Jan 18 '16 at 21:17      I desperately need that too!!! Did you figure out how to do it? –  Diego Pamio Apr 19 '16 at 3:20


2 Answers

JSFeat can do that for you. There even is an example for perspective distortion. You'll have to add/compute the source and destination points yourself.

  this answer
answered Mar 24 '16 at 12:04 arminrosu 82 11


Look like is wat you are looking for.

Create functions to map points from one arbitrary quadrilateral to another and vice versa with the inverse

  this answer
answered Oct 16 '16 at 15:46 Adrien Gibrat 737 8 10









您的注册邮箱: 修改

重新发送激活邮件 进入我的邮箱