无法使用 OpenCV.js 创建垫子
Unable to create Mat using OpenCV.js
我正在使用 opencv.js,当我调用 Mat class
的构造函数时出现错误
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)
你调用构造函数的方式不对
let mat = new cv.Mat(size, type);
您的尺码应该是具有 'width' 和 'height' 属性的对象
size = {'width': 100, 'height': 100}
或[100, 100]
示例:
let mat = new cv.Mat([100, 100], cv.CV_8UC3)
我正在使用 opencv.js,当我调用 Mat class
的构造函数时出现错误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)
你调用构造函数的方式不对
let mat = new cv.Mat(size, type);
您的尺码应该是具有 'width' 和 'height' 属性的对象
size = {'width': 100, 'height': 100}
或[100, 100]
示例:
let mat = new cv.Mat([100, 100], cv.CV_8UC3)