Ask Your Question

How can I compile OpenCV.js so that it does not require defining the "onRuntimeInitialized" field?

asked 2019-01-18 01:44:34 -0600

mchung gravatar image

updated 2019-01-18 02:39:16 -0600

I'm trying to expose more opencv modules to the existing opencv.js javascript module.

Following the official opencv instructions, I was able to build a wasm version of opencv.js (see here for more details), but it behaves differently than the one provided in the npm pkg - https//

Specifically, the opencv.js I built require me to define the "onRuntimeInitialized" field in the imported module (as reported by others, see here) where the one provided in npm pkg does not (see here, their module does not have "onRuntimeInitialized" and "wasmMaxTableSize", "wasmMemory", ... that are existing in the opencv.js I built).

I believe I can build opencv like the person who built the opencv.js like changing some emscripten flags for, but can't figure out what those flags are. Here are some places where the build script provided by opencv is setting emscripten flags: * *

How can I can build an wasm so it does not require me to define "onRuntimeInitialized" but loads all required modules at the import time?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-01-18 02:22:24 -0600

dkurt gravatar image

How can I can build an wasm so it does not require me to define "onRuntimeInitialized"

WASM is compiled in runtime so you need a callback to know when it's ready.

You can disable WASM: --disable_wasm (see arguments).

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-01-18 01:44:34 -0600

Seen: 1,371 times

Last updated: Jan 18 '19