Git Product home page Git Product logo

Comments (4)

njor avatar njor commented on September 27, 2024

Hi,
I have tried adapting the compilation instructions (in the readme) and adapted a few files to add WebAssembly support. The result is here: https://github.com/njor/opencvjs
The new compiled files can be found already built in the build folder here: https://github.com/njor/opencvjs/tree/master/build

from opencvjs.

drhouse82 avatar drhouse82 commented on September 27, 2024

Hi njor,
I'm glad to read that there now also is a webassembly version. I'm absolutely excited to test it.
I'm aware that importing wasm modules is a bit bulky at the moment (https://developer.mozilla.org/en-US/docs/WebAssembly/Loading_and_running)... So far I cannot imagine how to use the constructors (like so far "new cv.Mat()"...
Do you have a minimal working example, like define a Mat and do some operation on it?
This would surely save me immense amount of time.
Many thanks in advance...

from opencvjs.

njor avatar njor commented on September 27, 2024

Hi drhouse82,
The loading / initialization of the wasm module is taken care of by emscripten. The only thing you need to do is to create a global Module object with your configuration (see here for the details : https://kripken.github.io/emscripten-site/docs/api_reference/module.html), and then include the generated javascript file (cv-wasm.js) with a script tag.

You can find some examples in the test directory, and I have written a minimal working example to try and document the API slightly better, here : https://github.com/njor/opencvjs/blob/master/test/minimal-example.html
(But I am far from an expert, and am still struggling from time to time to understand the way emscripten binds stuff to JS. Oh well.)

Anyways, have fun. ^^

from opencvjs.

drhouse82 avatar drhouse82 commented on September 27, 2024

Hi njor,
thank you very much! works like a charm!
I somehow thought module loading was not yet ready... very nice!
Thanks again!

from opencvjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.