Skip to content

When binding APIs in opencv.js, corresponding structs/enums should be bound #25239

@vrabaud

Description

@vrabaud

System Information

Latest Debian, and OpenCV 4.x at HEAD

Detailed description

When building opencv.js following https://docs.opencv.org/4.x/d4/da1/tutorial_js_setup.html everything is fine.
But my company uses a different linker than the emscripten one and it finds issues.
The official linker does not check errors at link time, errors are only found at runtime: https://emscripten.org/docs/compiling/Dynamic-Linking.html#dynamic-checks

E.g.

  • the struct UsacParams is not bound in .js but used in finHomography which is bound (cf
    'findHomography',
    )
  • cv::AKAZE:DescriptorType that is used in cv::AKAZE::create()
    'AKAZE': ['create', 'setDescriptorType', 'getDescriptorType', 'setDescriptorSize', 'getDescriptorSize', 'setDescriptorChannels', 'getDescriptorChannels', 'setThreshold', 'getThreshold', 'setNOctaves', 'getNOctaves', 'setNOctaveLayers', 'getNOctaveLayers', 'setDiffusivity', 'getDiffusivity', 'getDefaultName'],
  • register_vector<std::vector<char>>("CharVectorVector"); also needs to be put in binding.cpp
  • DrawMatchesFlags also needs to be bound

There are probably more but being able to find and generate them would be more efficient.

BTW, the generated code also does not compile locally because of some minor C++ errors, e.g. some variables are set as const const instead of const.

Steps to reproduce

I unfortunately do not know which tools we are using so I can only reproduce locally ...

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions