mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
fix warp image example
This commit is contained in:
parent
18394814ab
commit
7ebb4d70de
@ -1,6 +1,6 @@
|
|||||||
var cv = require('../lib/opencv');
|
var cv = require('../lib/opencv');
|
||||||
|
|
||||||
cv.readImage("./mona.png", function(err, im) {
|
cv.readImage("./examples/files/mona.png", function(err, im) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|
||||||
var width = im.width();
|
var width = im.width();
|
||||||
@ -11,6 +11,6 @@ cv.readImage("./mona.png", function(err, im) {
|
|||||||
var dstArray = [0, 0, width * 0.9, height * 0.1, width, height, width * 0.2, height * 0.8];
|
var dstArray = [0, 0, width * 0.9, height * 0.1, width, height, width * 0.2, height * 0.8];
|
||||||
var xfrmMat = im.getPerspectiveTransform(srcArray, dstArray);
|
var xfrmMat = im.getPerspectiveTransform(srcArray, dstArray);
|
||||||
im.warpPerspective(xfrmMat, width, height, [255, 255, 255]);
|
im.warpPerspective(xfrmMat, width, height, [255, 255, 255]);
|
||||||
im.save("./warp-image.png");
|
im.save("./examples/tmp/warp-image.png");
|
||||||
console.log('Image saved to ./tmp/warp-image.png');
|
console.log('Image saved to ./tmp/warp-image.png');
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user