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

generateCvProps is almost useless #28

Open
studentutu opened this issue Jun 27, 2024 · 3 comments
Open

generateCvProps is almost useless #28

studentutu opened this issue Jun 27, 2024 · 3 comments

Comments

@studentutu
Copy link

I've cloned this repo, made a docker build for opencv 4.10 wasm, fixed issue with the generateCvProps as imports and initialization of opencv was incorrect and I finally generated types which were all almost useless
Fix for generateCvProps

const { cv: cvLoader } = require('../.'); // will use index.js and opencv.js

const Module = {};
const cv = cvLoader(Module);

Running it with bash command like so

#!/bin/bash

# assume you are in ./utils
node generateCvProps.js
npx tsc --declaration --allowJs --emitDeclarationOnly --outDir ../types ../types/opencv.ts

Gave me the following output on types:

/** function */
export var IntVector: any;

/** function */
export var CharVector: any;
......

So generateCvProps doesn't even produce interfaces, it just plain key -> values pair with a bit of comment on top of it.
Can you explain how to generate types in production?

@studentutu
Copy link
Author

We can try to link doxygen docs if we build wasm with it

@studentutu
Copy link
Author

@echamudi there is actually a pretty good flag in emcc ( opencv for js is build with it) -lembind --emit-tsd which creates typescript .d.ts for files ( not sure how to use it if we need to generate type definitions from cpp whole folder )

I'm currently working on the docker file which should create both openCV.js, opencv_js.wasm and type definitions for it
in here https://github.com/studentutu/opencv-wasm-node
If you can lend a hand in helping me generate types from emcc, it would be great

@studentutu
Copy link
Author

studentutu commented Jun 29, 2024

@UrielCh could you help with generating types from opencv? Your opencv4nodejs has all the types for opencv, could lend a hand in that? How to generate those types?

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

1 participant