findHomography error with opencv.js "Uncaught BindingError"
I'm attempting to reproduce Satya Mallick's great work from here but in JavaScript.
here is a screen shot of the debug match: https://imgur.com/8i4Gxlh
however on the findHomography() call I am getting an error:
Uncaught BindingError {name: "BindingError", message: "Cannot pass "[object Object],[object Object],[obje…Object],[object Object],[object Object]" as a Mat", stack: "BindingError: Cannot pass "[object Object],[object…t.onclick (http://localhost:8082/opencv#:190:194)"}message: "Cannot pass "[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]" as a Mat"name: "BindingError"stack: "BindingError: Cannot pass "[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]" as a Mat↵ at BindingError.<anonymous> (http://localhost:8082/js/opencv_4_3_0.js:30:7971681)↵ at new BindingError (eval at createNamedFunction (http://localhost:8082/js/opencv_4_3_0.js:30:7971390), <anonymous>:4:34)↵ at throwBindingError (http://localhost:8082/js/opencv_4_3_0.js:30:7976808)↵ at RegisteredPointer.nonConstNoSmartPtrRawPointerToWireType [as toWireType] (http://localhost:8082/js/opencv_4_3_0.js:30:7985609)↵ at Object.findHomography (eval at new_ (http://localhost:8082/js/opencv_4_3_0.js:30:7995155), <anonymous>:7:26)↵ at Object.proto.<computed> [as findHomography] (http://localhost:8082/js/opencv_4_3_0.js:30:7982013)↵ at Align_img2 (http://localhost:8082/opencv:1925:20)↵ at HTMLAnchorElement.onclick (http://localhost:8082/opencv#:190:194)"__proto__: Error
throwBindingError @ opencv_4_3_0.js:30
nonConstNoSmartPtrRawPointerToWireType @ opencv_4_3_0.js:30
findHomography @ VM404261:7
proto.<computed> @ opencv_4_3_0.js:30
Align_img2 @ opencv:1925
onclick @ VM406404 opencv:190
Here is the code:
function Align_img2() {
//image_A is the original image we are trying to align to
//image_B is the image we are trying to line up correctly
let image_A = cv.imread(imgElement_Baseline);
let image_B = cv.imread('imageChangeup');
let image_A_gray = new cv.Mat();
let image_B_gray = new cv.Mat();
//get size of baseline image (image A)
var image_A_width = image_A.cols;
var image_A_height = image_A.rows;
//resize image B to the baseline (image A) image
let image_A_dimensions = new cv.Size(image_A_width, image_A_height);
cv.resize(image_B, image_B, image_A_dimensions, cv.INTER_AREA);
// Convert both images to grayscale
cv.cvtColor(image_A, image_A_gray, cv.COLOR_BGRA2GRAY);
cv.cvtColor(image_B, image_B_gray, cv.COLOR_BGRA2GRAY);
// Initiate detector
var orb = new cv.ORB(1000);
var kpv_image_A = new cv.KeyPointVector();
var kpv_image_B = new cv.KeyPointVector();
var descriptors_image_A =new cv.Mat();
var descriptors_image_B =new cv.Mat();
var image_A_keypoints=new cv.Mat();
var image_B_keypoints =new cv.Mat();
mask = new cv.Mat();
orb.detectAndCompute(image_A_gray, new cv.Mat(), kpv_image_A, descriptors_image_A);
orb.detectAndCompute(image_B_gray ...