Skip to content

Added DMatch bindings - #13710

Merged
alalek merged 3 commits into
opencv:3.4from
ramezrafla:3.4
Jan 29, 2019
Merged

alalek merged 3 commits into
opencv:3.4from
ramezrafla:3.4

Conversation

@ramezrafla

Copy link
Copy Markdown
Contributor

This is an update to PR #13701 to base it on 3.4 -- we recompiled and retested build with 3.4
Text below taken from original PR (which will be closed):

This PR is necessary for opencv.js to implement the C to JS bindings for Emscripten needed for advanced pattern matching.

In the docs:
https://docs.opencv.org/3.4.5/db/d39/classcv_1_1DescriptorMatcher.html#a378f35c9b1a5dfa4022839a45cdf0e89

knnMatch needs input matches of type std::vector< std::vector< DMatch > > &
match needs input matches of type std::vector< DMatch > &

We have tested the matching functions with the code below and it worked as expected (new constructor cv.DMatchVectorVector):

  var orb = new cv.ORB();

  var kp1 = new cv.KeyPointVector();
  var des1 = new cv.Mat();
  orb.detectAndCompute(patternImg, new cv.Mat(), kp1, des1);

  var kp2 = new cv.KeyPointVector();
  var des2 = new cv.Mat();
  orb.detectAndCompute(fullImg, new cv.Mat(), kp2, des2);

  var matches = new cv.DMatchVectorVector();
  var bf = new cv.BFMatcher(cv.NORM_HAMMING2, false)
  var mask = new cv.Mat();
  bf.knnMatch(des1, des2, matches, 3, mask, false)

@alalek @huningxin

docker_image:Docs=docs-js
force_builders=linux,Docs,Custom
buildworker:Custom=linux-1,linux-2,linux-4
docker_image:Custom=javascript

@huningxin

Copy link
Copy Markdown
Contributor

It's cool. Thanks! @ramezrafla

It would be good to add some test cases.

@alalek

alalek commented Jan 29, 2019 •

Copy link
Copy Markdown
Member

Here:

modules/js/src/core_bindings.cpp:333: trailing whitespace.
+    
modules/js/src/core_bindings.cpp:334: trailing whitespace.
+    

Need to remove spaces from "empty" lines.

@alalek

alalek commented Jan 29, 2019

Copy link
Copy Markdown
Member

@huningxin Tests are in progress here: #12855

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Lets put it in, and then rebase #12855

@alalek
alalek merged commit eb00dce into opencv:3.4 Jan 29, 2019
@alalek alalek mentioned this pull request Feb 1, 2019
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
* Added DMatch bindings

* Added CR which was accidently removed to maintain consistency

* Removed trailing white-space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants