Opencv.js, InputArray, OutputArray

Hello,
I try to use opencv.js 'OpenCV: OpenCV.js Tutorials) with call to
cv.estimateAffine2D( srcArray, dstArray, inliers, cv.RANSAC, ...)

First, where can I find the help on calling prototype in JS. It is difficult to find correspondance between prototype in C++ and in JS.

Second, estimateAffine2D accepts argument as InputArray and OutputArray.
How can I create such type (I don’t find them when I use assistance during debug (input cv.xxx to get the list of functions or types))

Do you have a small sample of usage ?

Best regards.

those types do not exist in the js bindings.
however, assuming that cv.Mat is a good fit for anything, that looks like an array:

let from = cv.matFromArray(3, 2, cv.CV_32F, [1,1, 2,2, 1,3]);
let to   = cv.matFromArray(3, 2, cv.CV_32F, [1,2, 2,3, 1,4]);
let inliers = new cv.Mat();
let P = cv.estimateAffine2D(from, to, inliers, cv.RANSAC);

console.log(P.rows + " " + P.cols +  " " + P.type() + " | "  + inliers.rows + " "   + inliers.cols + " " + inliers.type());

2 3 6 | 3 1 0

P is:
1 0 0
0 1 1

1 Like