I am puzzled as to why the data32F dump shows NaNs. that shouldn’t be there. you just copy those x and y values from step 6, right?
here is how I build the point arrays prior to sending them to the cv.matFromArray() to build the Mat:
let points1 = [];
let points2 = [];
for (let i = 0; i < good_matches.size(); i++) {
points1.push( new cv.Point(keypoints1.get(good_matches.get(i).queryIdx).pt.x, keypoints1.get(good_matches.get(i).queryIdx).pt.y));
points2.push( new cv.Point(keypoints2.get(good_matches.get(i).trainIdx).pt.x, keypoints2.get(good_matches.get(i).trainIdx).pt.y));
}
here is an example of the beginning of point1 array:
[0 … 99]
0: Point
x: 371.2216796875
y: 258.982177734375
__proto__: Object
1: Point {x: 348.1711730957031, y: 262.8340759277344}
2: Point {x: 376.22442626953125, y: 266.4711608886719}
3: Point {x: 300.205810546875, y: 274.12786865234375}
4: Point {x: 197.02357482910156, y: 314.02392578125}
5: Point {x: 183.9698486328125, y: 324.82049560546875}
and there are no NaN’s in either point1 or point2 arrays
see if you can make a single-column two-channel matrix. the API should like that a lot better.
OK, I changed matFromArray to create type=13 (CV_CF_32FC2) with 1 column
let mat1 = cv.matFromArray(points1.length, 1, cv.CV_32FC2, points1);
let mat2 = cv.matFromArray(points2.length, 1, cv.CV_32FC2, points2);
still get the NaN’s in the Mat data32F dump. I did try
mat1 = cv.patchNaNs(mat1, 0.0);
but the API doesn’t exist in the JS version
I made these changes on the hosted page https://icollect.money/opencv_align#