Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
a66a1a24
Commit
a66a1a24
authored
Jul 20, 2019
by
Dmitry Kurtaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix drawKeypoints and drawMatches for JS
parent
099f4f9e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
embindgen.py
modules/js/src/embindgen.py
+2
-2
test_features2d.js
modules/js/test/test_features2d.js
+33
-0
No files found.
modules/js/src/embindgen.py
View file @
a66a1a24
...
@@ -141,7 +141,7 @@ features2d = {'Feature2D': ['detect', 'compute', 'detectAndCompute', 'descriptor
...
@@ -141,7 +141,7 @@ features2d = {'Feature2D': ['detect', 'compute', 'detectAndCompute', 'descriptor
'AKAZE'
:
[
'create'
,
'setDescriptorType'
,
'getDescriptorType'
,
'setDescriptorSize'
,
'getDescriptorSize'
,
'setDescriptorChannels'
,
'getDescriptorChannels'
,
'setThreshold'
,
'getThreshold'
,
'setNOctaves'
,
'getNOctaves'
,
'setNOctaveLayers'
,
'getNOctaveLayers'
,
'setDiffusivity'
,
'getDiffusivity'
,
'getDefaultName'
],
'AKAZE'
:
[
'create'
,
'setDescriptorType'
,
'getDescriptorType'
,
'setDescriptorSize'
,
'getDescriptorSize'
,
'setDescriptorChannels'
,
'getDescriptorChannels'
,
'setThreshold'
,
'getThreshold'
,
'setNOctaves'
,
'getNOctaves'
,
'setNOctaveLayers'
,
'getNOctaveLayers'
,
'setDiffusivity'
,
'getDiffusivity'
,
'getDefaultName'
],
'DescriptorMatcher'
:
[
'add'
,
'clear'
,
'empty'
,
'isMaskSupported'
,
'train'
,
'match'
,
'knnMatch'
,
'radiusMatch'
,
'clone'
,
'create'
],
'DescriptorMatcher'
:
[
'add'
,
'clear'
,
'empty'
,
'isMaskSupported'
,
'train'
,
'match'
,
'knnMatch'
,
'radiusMatch'
,
'clone'
,
'create'
],
'BFMatcher'
:
[
'isMaskSupported'
,
'create'
],
'BFMatcher'
:
[
'isMaskSupported'
,
'create'
],
''
:
[
'drawKeypoints'
,
'drawMatches'
]}
''
:
[
'drawKeypoints'
,
'drawMatches'
,
'drawMatchesKnn'
]}
calib3d
=
{
''
:
[
'findHomography'
]}
calib3d
=
{
''
:
[
'findHomography'
]}
...
@@ -562,7 +562,7 @@ class JSWrapperGenerator(object):
...
@@ -562,7 +562,7 @@ class JSWrapperGenerator(object):
match
=
re
.
search
(
r'const std::vector<(.*)>&'
,
arg_type
)
match
=
re
.
search
(
r'const std::vector<(.*)>&'
,
arg_type
)
if
match
:
if
match
:
type_in_vect
=
match
.
group
(
1
)
type_in_vect
=
match
.
group
(
1
)
if
type_in_vect
!=
'cv::Mat'
:
if
type_in_vect
in
[
'int'
,
'float'
,
'double'
,
'char'
,
'uchar'
,
'String'
,
'std::string'
]
:
casted_arg_name
=
'emscripten::vecFromJSArray<'
+
type_in_vect
+
'>('
+
arg_name
+
')'
casted_arg_name
=
'emscripten::vecFromJSArray<'
+
type_in_vect
+
'>('
+
arg_name
+
')'
arg_type
=
re
.
sub
(
r'std::vector<(.*)>'
,
'emscripten::val'
,
arg_type
)
arg_type
=
re
.
sub
(
r'std::vector<(.*)>'
,
'emscripten::val'
,
arg_type
)
w_signature
.
append
(
arg_type
+
' '
+
arg_name
)
w_signature
.
append
(
arg_type
+
' '
+
arg_name
)
...
...
modules/js/test/test_features2d.js
View file @
a66a1a24
...
@@ -80,3 +80,36 @@ QUnit.test('BFMatcher', function(assert) {
...
@@ -80,3 +80,36 @@ QUnit.test('BFMatcher', function(assert) {
assert
.
equal
(
dm
.
size
(),
67
);
assert
.
equal
(
dm
.
size
(),
67
);
});
});
QUnit
.
test
(
'Drawing'
,
function
(
assert
)
{
// Generate key points.
let
image
=
generateTestFrame
();
let
kp
=
new
cv
.
KeyPointVector
();
let
descriptors
=
new
cv
.
Mat
();
let
orb
=
new
cv
.
ORB
();
orb
.
detectAndCompute
(
image
,
new
cv
.
Mat
(),
kp
,
descriptors
);
assert
.
equal
(
kp
.
size
(),
67
);
let
dst
=
new
cv
.
Mat
();
cv
.
drawKeypoints
(
image
,
kp
,
dst
);
assert
.
equal
(
dst
.
rows
,
image
.
rows
);
assert
.
equal
(
dst
.
cols
,
image
.
cols
);
// Run a matcher.
let
dm
=
new
cv
.
DMatchVector
();
let
matcher
=
new
cv
.
BFMatcher
();
matcher
.
match
(
descriptors
,
descriptors
,
dm
);
assert
.
equal
(
dm
.
size
(),
67
);
cv
.
drawMatches
(
image
,
kp
,
image
,
kp
,
dm
,
dst
);
assert
.
equal
(
dst
.
rows
,
image
.
rows
);
assert
.
equal
(
dst
.
cols
,
2
*
image
.
cols
);
dm
=
new
cv
.
DMatchVectorVector
();
matcher
.
knnMatch
(
descriptors
,
descriptors
,
dm
,
2
);
assert
.
equal
(
dm
.
size
(),
67
);
cv
.
drawMatchesKnn
(
image
,
kp
,
image
,
kp
,
dm
,
dst
);
assert
.
equal
(
dst
.
rows
,
image
.
rows
);
assert
.
equal
(
dst
.
cols
,
2
*
image
.
cols
);
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment