Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more bindings for GUI - e.g. im.moveWindow #18

Closed
vjpr opened this issue Oct 13, 2017 · 6 comments
Closed

Add more bindings for GUI - e.g. im.moveWindow #18

vjpr opened this issue Oct 13, 2017 · 6 comments

Comments

@vjpr
Copy link

vjpr commented Oct 13, 2017

https://docs.opencv.org/3.3.0/d7/dfc/group__highgui.html#ga453d42fe4cb60e5723281a89973ee563

@justadudewhohacks
Copy link
Owner

Alright. Only moveWindow?

@vjpr
Copy link
Author

vjpr commented Oct 13, 2017

For now that was just one function I wanted to use that wasn't available.

I'm wondering if there is not a more automated way to easily implement all the methods?

@justadudewhohacks
Copy link
Owner

justadudewhohacks commented Oct 13, 2017

Nothing that I am aware of, not for nodejs bindings. There is an approach, which compiles some OpenCV modules to pure javascript via LLVM using emscripten, but the goal of opencv4nodejs is to provide native performance, easy multithreading, async methods and an comfortable to use API.

Implementing the bindings is actually not that hard, the main issue is, you have to know the OpenCV modules, for which you want to add bindings.

@vjpr
Copy link
Author

vjpr commented Oct 13, 2017

What if you parse the OpenCV API Docs and generate the entire api?

A quick search found some other people looking for the same thing over in peterbraden/node-opencv#290.

Great ideas here: http://answers.opencv.org/question/6618/how-python-api-is-generated/

Also, this project looks interesting: https://github.com/charto/nbind. But I have never tried it out.

@justadudewhohacks
Copy link
Owner

I think that's what I was talking about by compiling it to asm.js using emscripten. Haven't tried any of them yet, but as far as I know asm.js has still considerably less performance than native, maybe that might change with webassembly in future.

However I am also not sure, if it is possible to achieve async methods and multiple workers that way and how one would generate these, but I don't know asm.js well enough. I'm gonna have a look at your links, thanks for sharing.

@vjpr
Copy link
Author

vjpr commented Oct 13, 2017

I don't think using emscripten/asm is a good idea. Rather, its about generating the bindings from the c code.

The opencv python bindings are generated by parsing the c/cpp headers, and then using some string templates as explained in the answers.opencv.org link.

In the opencv codebase there is some interesting stuff in opencv/modules/{js,python,ts}.

justadudewhohacks added a commit that referenced this issue Oct 14, 2017
added moveWindow, destroyWindow, destroyAllWindows
piercus pushed a commit to piercus/opencv4nodejs that referenced this issue Apr 13, 2022
Last merged pr from justadudewhohacks/opencv4nodejs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants