OK, I’m very close. The result image is a bit twisted but it looks pretty good.
I changed how I built the points1 and points2 arrays.
let points1 = [];
let points2 = [];
for (let i = 0; i < good_matches.size(); i++) {
points1.push(keypoints1.get(good_matches.get(i).queryIdx ).pt.x );
points1.push(keypoints1.get(good_matches.get(i).queryIdx ).pt.y );
points2.push(keypoints2.get(good_matches.get(i).trainIdx ).pt.x );
points2.push(keypoints2.get(good_matches.get(i).trainIdx ).pt.y );
}
I updated iCollect