Skip to content

Commit

Permalink
inproce cc trackers code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
UrielCh committed Sep 26, 2024
1 parent 54d01b1 commit d81a9c7
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 56 deletions.
7 changes: 4 additions & 3 deletions cc/tracking/Trackers/TrackerBoosting.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ class TrackerBoosting : public Tracker {
static Nan::Persistent<v8::FunctionTemplate> constructor;

#if CV_VERSION_GREATER_EQUAL(4, 5, 2)
cv::Ptr<cv::legacy::Tracker> getTracker(){
cv::Ptr<cv::legacy::Tracker> getTracker()
#else
cv::Ptr<cv::Tracker> getTracker() {
cv::Ptr<cv::Tracker> getTracker()
#endif
{
return tracker;
}
}
}
;

Expand Down
7 changes: 4 additions & 3 deletions cc/tracking/Trackers/TrackerBoostingParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
#define __FF_TRACKERBOOSTINGPARAMS_H__

#if CV_VERSION_GREATER_EQUAL(4, 5, 2)
class TrackerBoostingParams : public FF::ObjectWrap<TrackerBoostingParams, cv::legacy::TrackerBoosting::Params> {
class TrackerBoostingParams : public FF::ObjectWrap<TrackerBoostingParams, cv::legacy::TrackerBoosting::Params>
#else
class TrackerBoostingParams : public FF::ObjectWrap<TrackerBoostingParams, cv::TrackerBoosting::Params> {
class TrackerBoostingParams : public FF::ObjectWrap<TrackerBoostingParams, cv::TrackerBoosting::Params>
#endif
public:
{
public:
static Nan::Persistent<v8::FunctionTemplate> constructor;

static const char* getClassName() {
Expand Down
10 changes: 5 additions & 5 deletions cc/tracking/Trackers/TrackerCSRT.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ class TrackerCSRT : public Tracker {
static Nan::Persistent<v8::FunctionTemplate> constructor;

#if CV_VERSION_GREATER_EQUAL(4, 5, 2)
cv::Ptr<cv::legacy::Tracker> getTracker(){
cv::Ptr<cv::legacy::Tracker> getTracker()
#else
cv::Ptr<cv::Tracker> getTracker() {
cv::Ptr<cv::Tracker> getTracker()
#endif
{
return tracker;
}
}
;
}
};

#endif

Expand Down
5 changes: 3 additions & 2 deletions cc/tracking/Trackers/TrackerGOTURN.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
#define __FF_TRACKERGOTURN_H__

#if CV_VERSION_GREATER_EQUAL(4, 5, 2)
class TrackerGOTURN : public FF::ObjectWrapBase<TrackerGOTURN>, public Nan::ObjectWrap {
class TrackerGOTURN : public FF::ObjectWrapBase<TrackerGOTURN>, public Nan::ObjectWrap
#else
class TrackerGOTURN : public Tracker {
class TrackerGOTURN : public Tracker
#endif
{
public:
cv::Ptr<cv::TrackerGOTURN> tracker;

Expand Down
12 changes: 6 additions & 6 deletions cc/tracking/Trackers/TrackerKCF.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ class TrackerKCF : public Tracker {
static Nan::Persistent<v8::FunctionTemplate> constructor;

#if CV_VERSION_GREATER_EQUAL(4, 5, 2)
cv::Ptr<cv::legacy::Tracker> getTracker(){
cv::Ptr<cv::legacy::Tracker> getTracker()
#else
cv::Ptr<cv::Tracker> getTracker() {
cv::Ptr<cv::Tracker> getTracker()
#endif
return tracker;
}
}
;
{
return tracker;
}
};

#endif

Expand Down
9 changes: 5 additions & 4 deletions cc/tracking/Trackers/TrackerMIL.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ class TrackerMIL : public Tracker {
static Nan::Persistent<v8::FunctionTemplate> constructor;

#if CV_VERSION_GREATER_EQUAL(4, 5, 2)
cv::Ptr<cv::legacy::Tracker> getTracker(){
cv::Ptr<cv::legacy::Tracker> getTracker()
#else
cv::Ptr<cv::Tracker> getTracker() {
cv::Ptr<cv::Tracker> getTracker()
#endif
return tracker;
}
{
return tracker;
}
}
;

Expand Down
1 change: 1 addition & 0 deletions cc/tracking/Trackers/TrackerMOSSE.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<v8::FunctionTemplate> TrackerMOSSE::constructor;
Expand Down
13 changes: 7 additions & 6 deletions cc/tracking/Trackers/TrackerMOSSE.h
Original file line number Diff line number Diff line change
@@ -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__
Expand All @@ -19,14 +20,14 @@ class TrackerMOSSE : public Tracker {
static Nan::Persistent<v8::FunctionTemplate> constructor;

#if CV_VERSION_GREATER_EQUAL(4, 5, 2)
cv::Ptr<cv::legacy::Tracker> getTracker(){
cv::Ptr<cv::legacy::Tracker> getTracker()
#else
cv::Ptr<cv::Tracker> getTracker() {
cv::Ptr<cv::Tracker> getTracker()
#endif
return tracker;
}
}
;
{
return tracker;
}
};

#endif

Expand Down
9 changes: 5 additions & 4 deletions cc/tracking/Trackers/TrackerMedianFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ class TrackerMedianFlow : public Tracker {
static Nan::Persistent<v8::FunctionTemplate> constructor;

#if CV_VERSION_GREATER_EQUAL(4, 5, 2)
cv::Ptr<cv::legacy::Tracker> getTracker(){
cv::Ptr<cv::legacy::Tracker> getTracker()
#else
cv::Ptr<cv::Tracker> getTracker() {
cv::Ptr<cv::Tracker> getTracker()
#endif
return tracker;
}
{
return tracker;
}
}
;

Expand Down
29 changes: 15 additions & 14 deletions cc/tracking/Trackers/TrackerNano.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@

Nan::Persistent<v8::FunctionTemplate> TrackerNano::constructor;

NAN_MODULE_INIT(TrackerNano::Init) {
v8::Local<v8::FunctionTemplate> ctor = Nan::New<v8::FunctionTemplate>(TrackerNano::New);
v8::Local<v8::ObjectTemplate> 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;
Expand Down Expand Up @@ -53,20 +68,6 @@ NAN_METHOD(TrackerNano::Update) {
}
}

NAN_MODULE_INIT(TrackerNano::Init) {
v8::Local<v8::FunctionTemplate> ctor = Nan::New<v8::FunctionTemplate>(TrackerNano::New);
v8::Local<v8::ObjectTemplate> 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();
Expand Down
5 changes: 1 addition & 4 deletions cc/tracking/Trackers/TrackerNano.h
Original file line number Diff line number Diff line change
@@ -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<TrackerNano>, public Nan::ObjectWrap {
public:
cv::Ptr<cv::TrackerNano> tracker;
Expand All @@ -25,5 +24,3 @@ class TrackerNano : public FF::ObjectWrapBase<TrackerNano>, public Nan::ObjectWr
#endif

#endif

#endif
10 changes: 5 additions & 5 deletions cc/tracking/Trackers/TrackerTLD.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class TrackerTLD : public Tracker {
static Nan::Persistent<v8::FunctionTemplate> constructor;

#if CV_VERSION_GREATER_EQUAL(4, 5, 2)
cv::Ptr<cv::legacy::Tracker> getTracker(){
cv::Ptr<cv::legacy::Tracker> getTracker()
#else
cv::Ptr<cv::Tracker> getTracker() {
cv::Ptr<cv::Tracker> getTracker()
#endif
{
return tracker;
}
}
;
}
};

#endif

0 comments on commit d81a9c7

Please sign in to comment.