justadudewhohacks / justadudewhohacks/opencv4nodejs

TypeError: cv.warpPerspective is not a function

Open
#512 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5.1k
Forks
826
PR merge metrics
No merged PRs in 30d

Description

Hi
this is my code

```
const cv = require('opencv4nodejs');
var image = cv.imread('/public/staictest/cc.jpg');

var dstTri = [];
var srcTri = [];

srcTri[0] = new cv.Point2(70, 73);
srcTri[1] = new cv.Point2(312, 70);
srcTri[2] = new cv.Point2(323, 223);
srcTri[3] = new cv.Point2(63, 230);

dstTri[0] = new cv.Point2(0, 0);
dstTri[1] = new cv.Point2(260,0);
dstTri[2] = new cv.Point2(260,160);
dstTri[3] = new cv.Point2(0,160);
console.log(dstTri,srcTri);

var transform = cv.getPerspectiveTransform(srcTri, dstTri);
var drcimage;
var size = new cv.Size(160,260);
drcimage = cv.warpPerspective(transform, size);

cv.imwrite('/public/staictest/1111.jpg', drcimage);
cv.waitKey();

```

when i run the code

```

drcimage = cv.warpPerspective(transform, size);
^

TypeError: cv.warpPerspective is not a function
at Object. (/home/test/nodejs/helloworld.js:25:15)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)
at bootstrap_node.js:507:3

```
What should I do?

Contributor guide

Open the contributing guide

Research direction

Read the opencv4nodejs warpPerspective API and compare it with the call in helloworld.js at line 25. Confirm the call produces an image suitable for cv.imwrite, then rerun the example and verify 1111.jpg is written without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
computer-vision
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.