Skip to content

WASM in node #1

@bartbutenaers

Description

@bartbutenaers

Hi @kizerkizer,

Thanks for sharing your example!
I'm struggling already quite some time getting wasm up and running in Node (to run OpenCv.js). Have tried all kind of stuff, but can't get it done. So hopefully you can give me some tips ...

OpenCv is a large C++ program for image processing. Recently they have ported it to Javascript (called OpenCv.js), to make it available for web applications. But I would like to run it in node:

var cv = require('opencv.js');
var matrix = new cv.Mat();
...

The above code uses the non-wasm (i.e. normal javascript) opencv.js file. That works fine in node, but it is VERY slow: takes 15 seconds to do some image processing on a single image. Since they have also build a WASM version of that opencv.js file, I tried to use that one (without success...).

I have installed wabt like in your repo, but some issues:

  • Can use "--expose-wasm" but not "--experimental-modules". Is there perhaps a minimal Node version required for (decent) Webassembly support?
  • When skipping the "--experimental-modules", the following error occurs:
    image

Thanks in advance for your help!
Kind regards,
Bart Butenaers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions