Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
The benefits of this would be also that is better integrated with web bundlers like webpack, parcel, browserify which simplify development workflow used in generally for web development.
I think for supporting this, the .wasm version could be better. BTW the current open.js file, although it works since it supports UMD, it would not be the best since it will be combined by bundlers (so the resulting .js file will contain it and will be huge bloking the user's apps). Instead it should be downloaded separately optionally allowing users to define an alternative url for it (like a CDN).
I'm working on a proof f concept for this, and also to support / tests for node.js as API and a little CLI tool too, and I wonder if something like this would be accepted as a PR to at least start the discussion.
I have feedback I would like to work on.
Initial slowdown because base 64 decoding of a string, not because of size.
WebAssembly output is polluted and there's no way to get the "clean" .wasm /asm.js output files
helpers.js and cv.imread
Of course the final idea is to contribute all of this to this project but right now I prefer to play and see which concrete parts I can push or are blockers for this, Help is welcome
Update: I implemented another Playground project but this time allowing users to experience TypeScript editor with autocompletion, type-checking and online docs (consuming the TS output of mirada) :
https://cancerberosgx.github.io/demos/mirada-ts-playground (tested only in chrome and firefox so far)
It uses monaco-editor (the same as vscode's) and consumes typescript declaration files that are automatically generated from opencv sources by this auxiliary tool of mine:
It currently consumes doxygen xml output. The only hack I made was to filter the content using bindings.cpp since the docs are huge and the js biuld only support a fraction of it. The rest mostly is XML paring, templates and a a couple of TypeScript AST manipulations at the end.
These are examples of the generated typescript declarations processed with jsdoc rendering tools - I didn't put much effort on them since I'm only interested in the editor/type checking experience but just for you to see the current status/quality:
Although there are some details still, (mostly with references, enum types and formula rendering) I'm quite happy with it and now I'm it'm using it successfully to learn the library's API since I'm actually totally new with it) . Probably in editor-consumable documentation/type-declarations (which is my target) I should use shorter descriptions, but for now (and for me) I'm dumping the whole thing.)
I'm porting examples while I learn and use them library tests/ CI or in the playground and I must say the port of examples in general is quite straight forward (and surprisingly easier from C++) - I think I cover in most of the use cases shown in the tutorials. Nevertheless I will keep adding more as I learn.
As I said, I have suggestions for the js build that I will try to translate to PRs, right now I prefer to learn and enjoy a little bit more before that, and wanted to give this update just in case anybody has some opinions / feedback. I'm sorry for taking this issue mostly to discuss with myself before I have a PR proposal or a concrete contribution. Thanks
Sure if build supports them I will try. I recently attempted to add the module ml (machine learning) in the js build and although it is included by cmake it is not published in the global Module variable. I wonder if you know about any documentation about this topic since I'm kind lost here and would be awesome to try ml and other more training-oriented modules in the browser and node.js.
I'm running the tests in node.js - about those two technologies I don't really know them, but if they are oriented toward small devices (and performance/battery is important) I would use the c++/python versions not this one. Specially if you execute it as a command line since
Also since this project has so little JS implementation it would be interesting to try https://docs.assemblyscript.org/ or similar to generate also compile the browse clue code r and user's as webassembly altogheter. I will try to test things like https://github.com/as2d/as2d to see how/if this kind of things can be (ever used them) although I don't know if these things are related to React Native or Native Script - will let you know, thanks
Although I never tried, emcc has some support for dynamic linking, They say is still experimental and has some impact on the speed : * https://emscripten.org/docs/compiling/Building-Projects.html#dynamic-linking * https://github.com/emscripten-core/emscripten/wiki/Linking
Also a question, ImageMagick which targets a similar area, has two important compile flags that let you trade off between processing speed, memory and image output quality / match precision.
The first flag impacts memory while this second flag impacts speed. just in case I want to know if there are any similar settings in opencv build ?
There is an issue working through adding new modules to the build. That is about SolvePnP and some other calib modules, but if one is able to add those, then the ML modules shouldn't be that much different.