'OpenCV with Blazor WebAssembly?
I'd like to build a web app with Blazor WebAssembly and do some image processing on the client side with OpenCV. I'm having difficulty using OpenCV on the client side. There are two approaches I've tried:
- Include the OpenCVSharp4 NuGet package in the Client project. However, as the OpenCVSharp is just a wrapper, I suppose that requires a runtime dll to do the actual work. I tired to add the OpenCVSharp4.runtime.win package and the code using OpenCV generates the error
WASM: System.TypeInitializationException: The type initializer for 'OpenCvSharp.NativeMethods' threw an exception. ---> System.DllNotFoundException: OpenCvSharpExtern assembly:<unknown assembly> type:<unknown type> member:(null)
saying it can't find the dll. - Use OpenCV.js with WebAssembly. I've tried just adding
<script src="opencv.js" async></script>
in index.html, but the app fail to load with the following error
Uncaught (in promise) TypeError: Cannot read property 'apply' of undefined
at Module.stackSave (dotnet.js:1)
at ccall (dotnet.js:1)
at Object.wasm_setenv (dotnet.js:1)
at Object.mono_wasm_setenv (dotnet.js:1)
at blazor.webassembly.js:1
at callRuntimeCallbacks (opencv.js:30)
at postRun (opencv.js:30)
at doRun (opencv.js:30)
at run (opencv.js:30)
at runCaller (opencv.js:30)
So is it feasible to use OpenCV on the client side with Blazor? If so, how to do that? Thanks in advance!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|