Closed studentutu closed 5 days ago
TypeError: cv.getAvailableBackends is not a function
Can't even initialize it using the actual openCv guide:
// Load opencv.js just like before but using Promise instead of callbacks:
function loadOpenCV() {
return new Promise(resolve => {
global.Module = {
onRuntimeInitialized: resolve
};
global.cv = require("@techstark/opencv-js");
});
}
Changed import from import * as cv from
to import cv from
and now I receive different error:
TypeError: opencv_js_1.default.getAvailableBackends is not a function
If using directly without timeouts - I receive the following error:
Uncaught Error: Unhandled error. ({
sender: EventEmitter {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
send: [Function (anonymous)],
sendSync: [Function (anonymous)],
sendToHost: [Function (anonymous)],
sendTo: [Function (anonymous)],
invoke: [AsyncFunction (anonymous)],
postMessage: [Function (anonymous)],
[Symbol(kCapture)]: false
},
senderId: 0,
ports: []
})
same on the render process - cv is just not initialized
@th-alexmak could you help find out why OpenCV is not initialized with electron? Both main and render process can't initialize opencv. I've even tried to build my own version - at the end - the same issue, opencv with wasm can't initialize for some reason.
Are there any debugging utilities to catch native initialization error? All i get is just missing functions....
@UrielCh maybe you had a similar experience in the opencv4node? Could you help us find out the initialization error?
@TechStark
@ttt43ttt
@studentutu do you have an example project to reproduce the issue?
@ttt43ttt here is https://github.com/studentutu/autoflow Feel free to ask questions. All you need is just node\npm\yarn
@studentutu There is no cv.getVersionString
function (it should be removed from the TS declaration). Try cv.getBuildInformation()
.
TypeError: Cannot convert "TypeError: opencv_js_1.default.getVersionString is not a function" to long
at Object.toWireType (C:\Users\stude\Desktop\autoflow\node_modules\@techstark\opencv-js\dist\opencv.js:1:10183883)
at Object.exceptionFromPtr (eval at new_ (C:\Users\stude\Desktop\autoflow\node_modules\@techstark\opencv-js\dist\opencv.js:1:10170916), <anonymous>:7:26)
at Timeout._onTimeout (C:\Users\stude\Desktop\autoflow\src\dist\Main\testopencv.js:68:52)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)
Node.js v18.15.0
error Command failed with exit code 7.
oh yes it does work! Thank for pointing it out
works in Main process
Good evening, I've tried to use it from the electron 25.0.1 ( Node.js v18.15.0) but every time openCVis initialized it dumps all of the js into console ( main console) and after all methods in openCV is not recognized ( probably failed to be loaded) Examples:
cv.getVersionString is not a function
Are there any workaround to skip dumping openCV logs into console? Should we initialize it separatly in Node environment?