How To Pass Image Frames Camera To A Function In Wasm (c++)?
I'm trying to build a C++ function and compile it to Wasm using Emscripten. What this function will do is receive an image and do some process on it and return a result. My first P
Solution 1:
I found a solution for this (maybe suits my case only).
When you're trying to get an image data from canvas
you get it as 4 channels (RGBA like in PNG), and depending on your image processing code you need to deal with it.
My code was considering that the image should be 3 channels (RGB like in jpeg) so I had to convert it using this code:
canvasBuffer.toBlob(function (blob) {
passToWASM(blob);
},'image/jpeg');
Post a Comment for "How To Pass Image Frames Camera To A Function In Wasm (c++)?"