Can anybody generate opencv.js?

前端 未结 4 1420
情书的邮戳
情书的邮戳 2021-02-14 11:53

I can\'t generate OpenCV.js using this instructions: https://docs.opencv.org/master/d4/da1/tutorial_js_setup.html

I have this error:

CMake Error:

相关标签:
4条回答
  • 2021-02-14 12:12

    You can find a nightly build at https://docs.opencv.org/master/opencv.js and some useful stuff at https://docs.opencv.org/master/utils.js .

    <script async src="https://docs.opencv.org/master/opencv.js" type="text/javascript"></script>
    
    0 讨论(0)
  • 2021-02-14 12:30

    I'll just list out the parts where installation was slightly different from what was outlined in https://docs.opencv.org/master/d4/da1/tutorial_js_setup.html.

    For installing Binaryen, make sure you cd into the emsdk directory and then run these:

    ./emsdk install binaryen-master-64bit
    ./emsdk activate binaryen-master-64bit
    

    From the official docs,

    python ./platforms/js/build_js.py build_js
    

    doesn't work because you need to add an additional flag --emscripten_dir to specify where the correct path. Note that you want the folder below the emsdk root directory, typically /fastcomp/emscripten/ (for the older “fastcomp” compiler; for the newer upstream LLVM wasm backend it will be /upstream/emscripten/).

    I personally used the /upstream/emscripten one

    So run this:

    python /Users/fangran/opencv/platforms/js/build_js.py build_wasm --build_wasm --emscripten_dir /Users/fangran/emsdk/upstream/emscripten
    

    And it should work and return:

    =====
    ===== Build finished
    =====
    OpenCV.js location: /Users/fangran/opencv/build_wasm/bin/opencv.js
    

    For more details: refer to this link

    0 讨论(0)
  • 2021-02-14 12:32

    I'm still not able to build it from source.

    But this version of opencv.js worked for me on MacOS https://docs.opencv.org/3.4/opencv.js

    0 讨论(0)
  • 2021-02-14 12:37

    Looks like Emscripten doesn't setup the enviroment variable correctly to the SDK

    For anyone trying to get this to build you need to specify the correct path to the Emscripten

    which is the path where Emscripten is installed found in emsdk/upstream/emscripten

    python ./platforms/js/build_js.py build_js --emscripten_dir=/home/username/Desktop/emsdk/upstream/emscripten
    

    This should then work

    0 讨论(0)
提交回复
热议问题