<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; opencv.js 4.1.0-pre</li>
<li>Operating System / Platform =&gt; Google Chrome 74.0.3729.39</li>
<li>Compiler =&gt; opencv.js WASM build from master branch as described <a href="https://docs.opencv.org/master/d4/da1/tutorial_js_setup.html" rel="nofollow">here</a>.</li>
</ul>
<h5 dir="auto">Detailed description</h5>

<p dir="auto">Executing cv.drawKeypoints now gives an error where it did not use to. (see <a href="https://github.com/ucisysarch/opencvjs/blob/master/test/features_2d.html">https://github.com/ucisysarch/opencvjs/blob/master/test/features_2d.html</a>)</p>
<p dir="auto">Inferring from the errors shown below my guess is that it could just be a function signature mismatch in the bindings. When adding the 'flag' integer in javascript, the error says drawKeypoints does not accept 5 arguments, yet when omitting the flag, it says it cannot convert 'undefined' to an unsigned int, coincidentally the type of the omitted flag.</p>
<h5 dir="auto">Steps to reproduce</h5>

<p dir="auto"><code class="notranslate">cv.drawKeypoints(input, keyPoints, output, color, 0);</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="app.js:157 Uncaught BindingError: Function 'drawKeypoints' called with an invalid number of arguments (5) - expects one of (,,,function drawKeypoints(arg0, arg1, arg2) {
if (arguments.length !== 3) {
throwBindingError('function drawKeypoints called with ' + arguments.length + ' arguments, expected 3 args!');
}
var arg0Wired = argType0.toWireType(null, arg0); // Mat
var arg1Wired = argType1.toWireType(null, arg1); // emscripten::val
var arg2Wired = argType2.toWireType(null, arg2); // Mat
invoker(fn, arg0Wired, arg1Wired, arg2Wired);
},function drawKeypoints(arg0, arg1, arg2, arg3) {
if (arguments.length !== 4) {
throwBindingError('function drawKeypoints called with ' + arguments.length + ' arguments, expected 4 args!');
}
var arg0Wired = argType0.toWireType(null, arg0); // Mat
var arg1Wired = argType1.toWireType(null, arg1); // emscripten::val
var arg2Wired = argType2.toWireType(null, arg2); // Mat
var arg3Wired = argType3.toWireType(null, arg3); // Scalar
invoker(fn, arg0Wired, arg1Wired, arg2Wired, arg3Wired);
arg3Wired_dtor(arg3Wired); // Scalar
})!"><pre class="notranslate"><code class="notranslate">app.js:157 Uncaught BindingError: Function 'drawKeypoints' called with an invalid number of arguments (5) - expects one of (,,,function drawKeypoints(arg0, arg1, arg2) {
if (arguments.length !== 3) {
throwBindingError('function drawKeypoints called with ' + arguments.length + ' arguments, expected 3 args!');
}
var arg0Wired = argType0.toWireType(null, arg0); // Mat
var arg1Wired = argType1.toWireType(null, arg1); // emscripten::val
var arg2Wired = argType2.toWireType(null, arg2); // Mat
invoker(fn, arg0Wired, arg1Wired, arg2Wired);
},function drawKeypoints(arg0, arg1, arg2, arg3) {
if (arguments.length !== 4) {
throwBindingError('function drawKeypoints called with ' + arguments.length + ' arguments, expected 4 args!');
}
var arg0Wired = argType0.toWireType(null, arg0); // Mat
var arg1Wired = argType1.toWireType(null, arg1); // emscripten::val
var arg2Wired = argType2.toWireType(null, arg2); // Mat
var arg3Wired = argType3.toWireType(null, arg3); // Scalar
invoker(fn, arg0Wired, arg1Wired, arg2Wired, arg3Wired);
arg3Wired_dtor(arg3Wired); // Scalar
})!
</code></pre></div>
<hr>
<p dir="auto"><code class="notranslate">cv.drawKeypoints(input, keyPoints, output, color);</code> OR <code class="notranslate">cv.drawKeypoints(input, keyPoints, output);</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="opencv.js:24 Uncaught TypeError: Cannot convert &quot;undefined&quot; to unsigned int
    at Object.toWireType (.../opencv.js:24:8400437)
    at __emval_as (.../opencv.js:24:8407557)
    at wasm-function[311]:47
    at wasm-function[313]:82
    at wasm-function[970]:38
    at wasm-function[914]:20
    at Module.dynCall_viiii (.../opencv.js:24:8452614)
    at dynCall_viiii_249 (eval at makeDynCaller (.../opencv.js:24:8383640), &lt;anonymous&gt;:4:12)
    at Object.drawKeypoints (eval at new_ (.../opencv.js:24:8387470), &lt;anonymous&gt;:10:1)
    at Object.proto.&lt;computed&gt; [as drawKeypoints] (.../opencv.js:24:8374345)"><pre class="notranslate"><code class="notranslate">opencv.js:24 Uncaught TypeError: Cannot convert "undefined" to unsigned int
    at Object.toWireType (.../opencv.js:24:8400437)
    at __emval_as (.../opencv.js:24:8407557)
    at wasm-function[311]:47
    at wasm-function[313]:82
    at wasm-function[970]:38
    at wasm-function[914]:20
    at Module.dynCall_viiii (.../opencv.js:24:8452614)
    at dynCall_viiii_249 (eval at makeDynCaller (.../opencv.js:24:8383640), &lt;anonymous&gt;:4:12)
    at Object.drawKeypoints (eval at new_ (.../opencv.js:24:8387470), &lt;anonymous&gt;:10:1)
    at Object.proto.&lt;computed&gt; [as drawKeypoints] (.../opencv.js:24:8374345)
</code></pre></div>
<p dir="auto">Is it feasible to merge some <a href="https://github.com/Web-Sight/opencvjs">Web-Sight</a> and <a href="https://github.com/Quramy/opencvjs">Quramy</a> bindings with master ? I don't really know how it can be done, but I would like to do it if so.</p>
<p dir="auto">It is used for example by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Quramy/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Quramy">@Quramy</a> in his feature_matching demo (see <a href="https://github.com/Quramy/opencv-wasm-knnmatch-demo">here</a>)<br>
to use feature2d functions like <code class="notranslate">cv.drawMatches</code>, <code class="notranslate">cv.knnMatch</code>, <code class="notranslate">cv.drawMatchesKnn</code>, <code class="notranslate">cv.drawKeypoints </code> and so on which are not working in master repo (if I'm correct).</p>
<p dir="auto"><strong>Errors</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let kp = new cv.KeyPointVector();
let descriptors = new cv.Mat();
let orb = new cv.ORB();
orb.detectAndCompute(src, new cv.Mat(), kp, descriptors);
cv.drawKeypoints(src, kp, dst); // Error here
kp.delete();
orb.delete();"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">kp</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-c1">KeyPointVector</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">descriptors</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-c1">Mat</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">orb</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-c1">ORB</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">orb</span><span class="pl-kos">.</span><span class="pl-en">detectAndCompute</span><span class="pl-kos">(</span><span class="pl-s1">src</span><span class="pl-kos">,</span> <span class="pl-k">new</span> <span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-c1">Mat</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-s1">kp</span><span class="pl-kos">,</span> <span class="pl-s1">descriptors</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-en">drawKeypoints</span><span class="pl-kos">(</span><span class="pl-s1">src</span><span class="pl-kos">,</span> <span class="pl-s1">kp</span><span class="pl-kos">,</span> <span class="pl-s1">dst</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// Error here</span>
<span class="pl-s1">kp</span><span class="pl-kos">.</span><span class="pl-en">delete</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">orb</span><span class="pl-kos">.</span><span class="pl-en">delete</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">raise following error</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: Cannot convert &quot;undefined&quot; to unsigned int"><pre class="notranslate"><code class="notranslate">TypeError: Cannot convert "undefined" to unsigned int
</code></pre></div>
<p dir="auto">and</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let kp = new cv.KeyPointVector();
let descriptors = new cv.Mat();
let orb = new cv.ORB();
orb.detectAndCompute(src, new cv.Mat(), kp, descriptors);

// Run a matcher.
let dm = new cv.DMatchVector();
let matcher = new cv.BFMatcher();
matcher.match(descriptors, descriptors, dm);
const matchingImage = new cv.Mat();
cv.drawMatchesKnn(src, descriptors, src, descriptors, dm, matchingImage);"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">kp</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-c1">KeyPointVector</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">descriptors</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-c1">Mat</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">orb</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-c1">ORB</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">orb</span><span class="pl-kos">.</span><span class="pl-en">detectAndCompute</span><span class="pl-kos">(</span><span class="pl-s1">src</span><span class="pl-kos">,</span> <span class="pl-k">new</span> <span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-c1">Mat</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-s1">kp</span><span class="pl-kos">,</span> <span class="pl-s1">descriptors</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">// Run a matcher.</span>
<span class="pl-k">let</span> <span class="pl-s1">dm</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-c1">DMatchVector</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">let</span> <span class="pl-s1">matcher</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-c1">BFMatcher</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">matcher</span><span class="pl-kos">.</span><span class="pl-en">match</span><span class="pl-kos">(</span><span class="pl-s1">descriptors</span><span class="pl-kos">,</span> <span class="pl-s1">descriptors</span><span class="pl-kos">,</span> <span class="pl-s1">dm</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">const</span> <span class="pl-s1">matchingImage</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-c1">Mat</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-en">drawMatchesKnn</span><span class="pl-kos">(</span><span class="pl-s1">src</span><span class="pl-kos">,</span> <span class="pl-s1">descriptors</span><span class="pl-kos">,</span> <span class="pl-s1">src</span><span class="pl-kos">,</span> <span class="pl-s1">descriptors</span><span class="pl-kos">,</span> <span class="pl-s1">dm</span><span class="pl-kos">,</span> <span class="pl-s1">matchingImage</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">raise</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: cv.drawMatchesKnn is not a function"><pre class="notranslate"><code class="notranslate">TypeError: cv.drawMatchesKnn is not a function
</code></pre></div>
<p dir="auto">while</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="cv.drawMatches(src, descriptors, src, descriptors, dm, matchingImage); // Error (2)"><pre class="notranslate"><span class="pl-s1">cv</span><span class="pl-kos">.</span><span class="pl-en">drawMatches</span><span class="pl-kos">(</span><span class="pl-s1">src</span><span class="pl-kos">,</span> <span class="pl-s1">descriptors</span><span class="pl-kos">,</span> <span class="pl-s1">src</span><span class="pl-kos">,</span> <span class="pl-s1">descriptors</span><span class="pl-kos">,</span> <span class="pl-s1">dm</span><span class="pl-kos">,</span> <span class="pl-s1">matchingImage</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// Error (2)</span></pre></div>
<p dir="auto">raise</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: Cannot convert &quot;undefined&quot; to unsigned int"><pre class="notranslate"><code class="notranslate">TypeError: Cannot convert "undefined" to unsigned int
</code></pre></div>
<p dir="auto"><strong>Environnement</strong><br>
I built opencv.js upon opencv master branch and I added to core_bindings.cpp some lines from not merged pull request <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="370520269" data-permission-text="Title is private" data-url="https://github.com/opencv/opencv/issues/12855" data-hovercard-type="pull_request" data-hovercard-url="/opencv/opencv/pull/12855/hovercard" href="https://github.com/opencv/opencv/pull/12855">#12855</a> to get DMatch support (see <a href="https://github.com/opencv/opencv/pull/12855/commits/05665f38979f49d87424b7113b8093f0f13b4c79#diff-1edbc1c9e1c9478205122f6accffa452R337">here</a>).</p>