Hey, I’ve been brawling this setup process forever and am hoping someone can help.
I built opencv.js from source using this command:
emcmake python3 opencv/platforms/js/build_js.py build_asm --disable_wasm --emscripten_dir="/mnt/c/users/magma/emsdk/upstream/emscripten" --cmake_option="-DCMAKE_TOOLCHAIN_FILE=/mnt/c/Users/magma/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" --cmake_option="-DCMAKE_CROSSCOMPILING_EMULATOR=/mnt/c/Users/magma/emsdk/node/16.20.0_64bit/bin/node"
It builds flawlessly, and passes most of the tests (which I think is intended). However, the opencv.js I built doesn’t seem to work. When I load it and attempt to use an openCV function, I get this error:
Uncaught TypeError: cv.getBuildInformation is not a function
at opencvcheck (example2.html:12:20)
at HTMLScriptElement.onload (example2.html:16:33)
When I replace the opencv.js file I built with the downloadable base one, the same program works. So clearly something is up with the process which I used to build my opencv.js, but the command I ran should work and no errors are brought up when I build it.
For what it’s worth, this is the program I’m running (which doesn’t work with my opencv.js, but works with the downloadable default opencv.js):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Please work </title>
</head>
<body>
<h2 id="checker" style="color: green;">OpenCV is loading...</h2>
<script type="text/javascript">
function opencvcheck(){
document.getElementById('checker').innerHTML="OpenCV is ready. (hallelujah)"
console.log(cv.getBuildInformation());
}
</script>
<script async src="./opencv.js" onload="opencvcheck()"
type="text/javascript"></script>
</body>
</html>
Please throw any ideas my way if you have em… this process is driving me crazy and I’ve scoured everywhere for answers to no avail