我正在使用opencv.js当我调用Mat类的构造函数时,我收到错误new cv.Mat(100, 100)opencv.js:30 Uncaught (in promise) TypeError: Cannot use 'in' operator to search for 'width' in 100
at Object.toWireType (opencv.js:30)
at Mat.constructor_body (opencv.js:30)
at Mat.<anonymous> (opencv.js:30)
at new Mat (eval at createNamedFunction (opencv.js:30), <anonymous>:4:34)
at Object.window.cv.onRuntimeInitialized (SplashView.vue?f176:10)
at doRun (opencv.js:30)
at run (opencv.js:30)
at runCaller (opencv.js:30)
at removeRunDependency (opencv.js:30)
at receiveInstance (opencv.js:30)
1 回答
智慧大石
TA贡献1946条经验 获得超3个赞
您以错误的方式调用构造函数
let mat = new cv.Mat(size, type);
您的大小应为具有“宽度”和“高度”属性的对象
size = {'width': 100, 'height': 100}
或 [100, 100]
例:
let mat = new cv.Mat([100, 100], cv.CV_8UC3)
添加回答
举报
0/150
提交
取消