Automatically Generated Bindings
Something I've been looking into for a little while. The OpenCV build process generates python and matlab bindings automatically from the C++ source. One of the issues these JS bindings seem to have is lack of feature support. What do you think about cutting a new version that can do a similar automatic generation for javascript?
Of course this would be very much incompatible with the current JS api, but we would theoretically be able to support most if not all of the features and they would match the C++ api closer
http://answers.opencv.org/question/6618/how-python-api-is-generated/ just for reference.
I don't mean to populate the Issues page here. I'm currently having to wade through the Examples to find ways of doing things. Is there a list of implemented functions? Please see my question here http://stackoverflow.com/questions/34518140/list-of-node-opencv-function-names
Is there any reason why we couldn't generate Javascript bindings from the same tool, then augment them to add things like async calls and streaming? Has anyone tried this?
Hi @Queuecumber , here's my effort so far:
https://github.com/johncant/opencv/tree/node_bindings
Essentially, all I've done so far is copied and pasted bits of cmake involved in the Python bindings generation to get to the point where the node bindings would be generated. My plan is:
- Hack gen2.py to produce safe C++ for use with node.js
- Produce typescript definitions
- Also produce an async version of every function (saves having to manually annotate anything)
- Get it to compile
- The next step I'm a bit unsure of. Maybe an npm module is necessary for people to put in their package.json . Its only function would be to find the installed bindings and require them. Or, maybe a script to turn opencv into a standalone node module that publishes itself.
There's also supposed to be a way of getting OpenCV to compile to Javascript using Emscripten but I can't find any info on it.
Did you get any further with this @johncant? I like this approach.
Found this library that seems to generate bindings automatically :rocket: https://github.com/ucisysarch/opencvjs
Another approach would be to do it similar to the Matlab bindings. This module is very well documented in the official opencv_contrib repository.