node.js - How to fix image perspective distortion and rotation with JavaScript?
2021腾讯云限时秒杀,爆款1核2G云服务器298元/3年!(领取2860元代金券),
地址:https://cloud.tencent.com/act/cps/redirect?redirect=1062
2021阿里云最低价产品入口+领取代金券(老用户3折起),
入口地址:https://www.aliyun.com/minisite/goods
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
2
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 https://www.npmjs.com/package/perspective-transform 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
|
相关阅读排行
- 1使用 async Node.js 简化Javascript代码
- 2了不起的Node.js: 将JavaScript进行到底(Web开发首选,实时,跨多服务器,高并发)
- 3javascript/node.js 中 setTimeout(callback,delay) 中的 this
- 4观《Node.js开发指南》之杂谈
- 5Node.js入门之神秘的服务器端JavaScript