WebAssembly OpenCV.js and camera processing with Embind-ed C++ functions

asked 2018-08-02 14:01:05 -0600

Jendker gravatar image

updated 2018-08-03 03:37:55 -0600

If I am using opencv.js as described here (https://docs.opencv.org/3.4/dd/d00/tu...) to get images from camera. I would like to process the frames in the C++ function binded with Embind, because then I can use the same functions to conveniently debug the code locally.

  • Is it possible to compile such code (opencv.js and my Embind functions), to have everything in one module?
  • I am having the problem with passing the cv.Mat objects from camera (read with opencv.js (https://docs.opencv.org/3.4/dd/d00/tu... to Embind(ed) functions, I am getting "Uncaught UnboundTypeError: Cannot call XXX due to unbound types: N2cv3MatE". The cv::Mat type between opencv.js and c++ code is not compatible (a pity). Should I get the vector of all elements and pass it to Embind function? This sounds like unnecessary overhead... How to do it in a neater way?

Thank you very much for your help!

edit retag flag offensive close merge delete

Comments

i have no idea, but maybe take a look here

berak gravatar imageberak ( 2018-08-03 03:57:23 -0600 )edit

Thanks! It gave me the idea to get the camera object directly into C++ in similar way how it is done with these bindings. I'll give it a try.

Jendker gravatar imageJendker ( 2018-08-03 05:46:57 -0600 )edit

glad you found it useful, lol ;)

berak gravatar imageberak ( 2018-08-03 06:21:50 -0600 )edit

Ok, it didn't help :D Does anyone have an idea how to access the camera from the website level so that it will be possible to pass it to cv::VideoCapture constructor?

Jendker gravatar imageJendker ( 2018-08-03 08:46:44 -0600 )edit