This repository was archived by the owner on Oct 18, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +57
-6
lines changed Expand file tree Collapse file tree 3 files changed +57
-6
lines changed Original file line number Diff line number Diff line change 1
1
#include " BFMatcher.h"
2
+ #include " BFMatcherBindings.h"
2
3
3
4
Nan::Persistent<v8::FunctionTemplate> BFMatcher::constructor;
4
5
@@ -49,4 +50,19 @@ NAN_METHOD(BFMatcher::New) {
49
50
info.GetReturnValue ().Set (info.Holder ());
50
51
}
51
52
53
+ NAN_METHOD (BFMatcher::match) {
54
+ FF::SyncBinding (
55
+ std::make_shared<BFMatcherBindings::MatchWorker>(FF_UNWRAP (info.This (), BFMatcher)->bfmatcher ),
56
+ " BFMatcher::match" ,
57
+ info
58
+ );
59
+ }
60
+
61
+ NAN_METHOD (BFMatcher::matchAsync) {
62
+ FF::AsyncBinding (
63
+ std::make_shared<BFMatcherBindings::MatchWorker>(FF_UNWRAP (info.This (), BFMatcher)->bfmatcher ),
64
+ " FeatureDetector::matchAsync" ,
65
+ info
66
+ );
67
+ }
52
68
Original file line number Diff line number Diff line change 1
1
#include " macros.h"
2
- #include " NativeNodeUtils.h "
2
+ #include < opencv2/core.hpp >
3
3
#include < opencv2/features2d.hpp>
4
+ #include " KeyPoint.h"
5
+ #include " Mat.h"
6
+ #include " CatchCvExceptionWorker.h"
4
7
5
8
#ifndef __FF_BFMATCHER_H__
6
9
#define __FF_BFMATCHER_H__
@@ -25,11 +28,8 @@ class BFMatcher : public Nan::ObjectWrap {
25
28
static NAN_MODULE_INIT (Init);
26
29
27
30
static NAN_METHOD (New);
28
- // static NAN_METHOD(Clone);
29
- // static NAN_METHOD(Create);
30
- // static NAN_METHOD(IsMaskSupported);
31
- // static NAN_METHOD(KnnMatchImpl);
32
- // static NAN_METHOD(RadiusMatchImpl);
31
+ static NAN_METHOD (match);
32
+ static NAN_METHOD (matchAsync);
33
33
34
34
static const char * getClassName () {
35
35
return " BFMatcher" ;
Original file line number Diff line number Diff line change
1
+ #include " BFMatcher.h"
2
+
3
+ #ifndef __FF_BFMATCHERBINDINGS_H_
4
+ #define __FF_BFMATCHERBINDINGS_H_
5
+
6
+ namespace BFMatcherBindings {
7
+
8
+ struct MatchWorker : public CatchCvExceptionWorker {
9
+ public:
10
+ cv::Ptr<cv::BFMatcher> bfmatcher;
11
+ MatchWorker (cv::Ptr<cv::BFMatcher> _bfmatcher) {
12
+ this ->bfmatcher = _bfmatcher;
13
+ }
14
+
15
+ cv::Mat descFrom;
16
+ cv::Mat descTo;
17
+ std::vector<cv::DMatch> dmatches;
18
+
19
+ std::string executeCatchCvExceptionWorker () {
20
+ bfmatcher->match (descFrom, descTo, dmatches);
21
+ return " " ;
22
+ }
23
+
24
+ bool unwrapRequiredArgs (Nan::NAN_METHOD_ARGS_TYPE info) {
25
+ return Mat::Converter::arg (0 , &descFrom, info)
26
+ || Mat::Converter::arg (1 , &descTo, info);
27
+ }
28
+
29
+ FF_VAL getReturnValue () {
30
+ return ObjectArrayConverter<BFMatcher, cv::DMatch>::wrap (dmatches);
31
+ }
32
+ };
33
+ }
34
+
35
+ #endif
You can’t perform that action at this time.
0 commit comments