diff --git a/cc/tracking/Trackers/TrackerBoosting.h b/cc/tracking/Trackers/TrackerBoosting.h index 7a047fe9..89ff1858 100644 --- a/cc/tracking/Trackers/TrackerBoosting.h +++ b/cc/tracking/Trackers/TrackerBoosting.h @@ -17,12 +17,13 @@ class TrackerBoosting : public Tracker { static Nan::Persistent constructor; #if CV_VERSION_GREATER_EQUAL(4, 5, 2) - cv::Ptr getTracker(){ + cv::Ptr getTracker() #else - cv::Ptr getTracker() { + cv::Ptr getTracker() #endif + { return tracker; -} + } } ; diff --git a/cc/tracking/Trackers/TrackerBoostingParams.h b/cc/tracking/Trackers/TrackerBoostingParams.h index db2fdefe..dfcd3ecf 100644 --- a/cc/tracking/Trackers/TrackerBoostingParams.h +++ b/cc/tracking/Trackers/TrackerBoostingParams.h @@ -8,11 +8,12 @@ #define __FF_TRACKERBOOSTINGPARAMS_H__ #if CV_VERSION_GREATER_EQUAL(4, 5, 2) -class TrackerBoostingParams : public FF::ObjectWrap { +class TrackerBoostingParams : public FF::ObjectWrap #else -class TrackerBoostingParams : public FF::ObjectWrap { +class TrackerBoostingParams : public FF::ObjectWrap #endif -public: +{ + public: static Nan::Persistent constructor; static const char* getClassName() { diff --git a/cc/tracking/Trackers/TrackerCSRT.h b/cc/tracking/Trackers/TrackerCSRT.h index 8400e2da..8fdc7b70 100644 --- a/cc/tracking/Trackers/TrackerCSRT.h +++ b/cc/tracking/Trackers/TrackerCSRT.h @@ -19,14 +19,14 @@ class TrackerCSRT : public Tracker { static Nan::Persistent constructor; #if CV_VERSION_GREATER_EQUAL(4, 5, 2) - cv::Ptr getTracker(){ + cv::Ptr getTracker() #else - cv::Ptr getTracker() { + cv::Ptr getTracker() #endif + { return tracker; -} -} -; + } +}; #endif diff --git a/cc/tracking/Trackers/TrackerGOTURN.h b/cc/tracking/Trackers/TrackerGOTURN.h index 9062b934..ddcbae7c 100644 --- a/cc/tracking/Trackers/TrackerGOTURN.h +++ b/cc/tracking/Trackers/TrackerGOTURN.h @@ -6,10 +6,11 @@ #define __FF_TRACKERGOTURN_H__ #if CV_VERSION_GREATER_EQUAL(4, 5, 2) -class TrackerGOTURN : public FF::ObjectWrapBase, public Nan::ObjectWrap { +class TrackerGOTURN : public FF::ObjectWrapBase, public Nan::ObjectWrap #else -class TrackerGOTURN : public Tracker { +class TrackerGOTURN : public Tracker #endif +{ public: cv::Ptr tracker; diff --git a/cc/tracking/Trackers/TrackerKCF.h b/cc/tracking/Trackers/TrackerKCF.h index 02a3220c..33d01b9d 100644 --- a/cc/tracking/Trackers/TrackerKCF.h +++ b/cc/tracking/Trackers/TrackerKCF.h @@ -19,14 +19,14 @@ class TrackerKCF : public Tracker { static Nan::Persistent constructor; #if CV_VERSION_GREATER_EQUAL(4, 5, 2) - cv::Ptr getTracker(){ + cv::Ptr getTracker() #else - cv::Ptr getTracker() { + cv::Ptr getTracker() #endif - return tracker; -} -} -; + { + return tracker; + } +}; #endif diff --git a/cc/tracking/Trackers/TrackerMIL.h b/cc/tracking/Trackers/TrackerMIL.h index 20dd9ee4..8e72cdc7 100644 --- a/cc/tracking/Trackers/TrackerMIL.h +++ b/cc/tracking/Trackers/TrackerMIL.h @@ -17,12 +17,13 @@ class TrackerMIL : public Tracker { static Nan::Persistent constructor; #if CV_VERSION_GREATER_EQUAL(4, 5, 2) - cv::Ptr getTracker(){ + cv::Ptr getTracker() #else - cv::Ptr getTracker() { + cv::Ptr getTracker() #endif - return tracker; -} + { + return tracker; + } } ; diff --git a/cc/tracking/Trackers/TrackerMOSSE.cc b/cc/tracking/Trackers/TrackerMOSSE.cc index bcfda4c8..203eee69 100644 --- a/cc/tracking/Trackers/TrackerMOSSE.cc +++ b/cc/tracking/Trackers/TrackerMOSSE.cc @@ -4,6 +4,7 @@ #include "TrackerMOSSE.h" +// Ensure that this code is only compiled if OpenCV is 3.4.0 or greater #if CV_VERSION_GREATER_EQUAL(3, 4, 0) Nan::Persistent TrackerMOSSE::constructor; diff --git a/cc/tracking/Trackers/TrackerMOSSE.h b/cc/tracking/Trackers/TrackerMOSSE.h index 43d7ff69..26dbc5ef 100644 --- a/cc/tracking/Trackers/TrackerMOSSE.h +++ b/cc/tracking/Trackers/TrackerMOSSE.h @@ -1,5 +1,6 @@ #include "../Tracker.h" +// Ensure that TrackerNano is only defined for OpenCV 3.4.0 or greater #if CV_VERSION_GREATER_EQUAL(3, 4, 0) #ifndef __FF_TRACKERMOSSE_H__ @@ -19,14 +20,14 @@ class TrackerMOSSE : public Tracker { static Nan::Persistent constructor; #if CV_VERSION_GREATER_EQUAL(4, 5, 2) - cv::Ptr getTracker(){ + cv::Ptr getTracker() #else - cv::Ptr getTracker() { + cv::Ptr getTracker() #endif - return tracker; -} -} -; + { + return tracker; + } +}; #endif diff --git a/cc/tracking/Trackers/TrackerMedianFlow.h b/cc/tracking/Trackers/TrackerMedianFlow.h index a0e1fe90..e0098c64 100644 --- a/cc/tracking/Trackers/TrackerMedianFlow.h +++ b/cc/tracking/Trackers/TrackerMedianFlow.h @@ -17,12 +17,13 @@ class TrackerMedianFlow : public Tracker { static Nan::Persistent constructor; #if CV_VERSION_GREATER_EQUAL(4, 5, 2) - cv::Ptr getTracker(){ + cv::Ptr getTracker() #else - cv::Ptr getTracker() { + cv::Ptr getTracker() #endif - return tracker; -} + { + return tracker; + } } ; diff --git a/cc/tracking/Trackers/TrackerNano.cc b/cc/tracking/Trackers/TrackerNano.cc index 1c4e555e..21de1cc5 100644 --- a/cc/tracking/Trackers/TrackerNano.cc +++ b/cc/tracking/Trackers/TrackerNano.cc @@ -9,6 +9,21 @@ Nan::Persistent TrackerNano::constructor; +NAN_MODULE_INIT(TrackerNano::Init) { + v8::Local ctor = Nan::New(TrackerNano::New); + v8::Local instanceTemplate = ctor->InstanceTemplate(); + + Nan::SetPrototypeMethod(ctor, "init", TrackerNano::Init); + Nan::SetPrototypeMethod(ctor, "update", TrackerNano::Update); + + constructor.Reset(ctor); + ctor->SetClassName(FF::newString("TrackerNano")); + instanceTemplate->SetInternalFieldCount(1); + + Nan::Set(target, FF::newString("TrackerNano"), FF::getFunction(ctor)); +}; + + NAN_METHOD(TrackerNano::Init) { FF::TryCatch tryCatch("TrackerNano::Init"); cv::Mat image; @@ -53,20 +68,6 @@ NAN_METHOD(TrackerNano::Update) { } } -NAN_MODULE_INIT(TrackerNano::Init) { - v8::Local ctor = Nan::New(TrackerNano::New); - v8::Local instanceTemplate = ctor->InstanceTemplate(); - - Nan::SetPrototypeMethod(ctor, "init", TrackerNano::Init); - Nan::SetPrototypeMethod(ctor, "update", TrackerNano::Update); - - constructor.Reset(ctor); - ctor->SetClassName(FF::newString("TrackerNano")); - instanceTemplate->SetInternalFieldCount(1); - - Nan::Set(target, FF::newString("TrackerNano"), FF::getFunction(ctor)); -}; - NAN_METHOD(TrackerNano::New) { FF::TryCatch tryCatch("TrackerNano::New"); FF_ASSERT_CONSTRUCT_CALL(); diff --git a/cc/tracking/Trackers/TrackerNano.h b/cc/tracking/Trackers/TrackerNano.h index 771001e0..7239d85e 100644 --- a/cc/tracking/Trackers/TrackerNano.h +++ b/cc/tracking/Trackers/TrackerNano.h @@ -1,12 +1,11 @@ #include "../Tracker.h" +// Ensure that TrackerNano is only defined for OpenCV 4.7.0 or greater #if CV_VERSION_GREATER_EQUAL(4, 7, 0) #ifndef __FF_TRACKERNANO_H__ #define __FF_TRACKERNANO_H__ -// Ensure that TrackerNano is only defined for OpenCV 4.7.0 or greater -#if CV_VERSION_GREATER_EQUAL(4, 7, 0) class TrackerNano : public FF::ObjectWrapBase, public Nan::ObjectWrap { public: cv::Ptr tracker; @@ -25,5 +24,3 @@ class TrackerNano : public FF::ObjectWrapBase, public Nan::ObjectWr #endif #endif - -#endif diff --git a/cc/tracking/Trackers/TrackerTLD.h b/cc/tracking/Trackers/TrackerTLD.h index 4f41c0b8..9bacae20 100644 --- a/cc/tracking/Trackers/TrackerTLD.h +++ b/cc/tracking/Trackers/TrackerTLD.h @@ -17,13 +17,13 @@ class TrackerTLD : public Tracker { static Nan::Persistent constructor; #if CV_VERSION_GREATER_EQUAL(4, 5, 2) - cv::Ptr getTracker(){ + cv::Ptr getTracker() #else - cv::Ptr getTracker() { + cv::Ptr getTracker() #endif + { return tracker; -} -} -; + } +}; #endif