Skip to content

Commit

Permalink
Facemark API fix build for older contrib versions
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasc committed Apr 24, 2018
1 parent 4920f5c commit 8d04229
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cc/modules/face/Facemark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "Facemark.h"
#include "FacemarkBindings.h"

#if CV_VERSION_MINOR >= 4

NAN_METHOD(Facemark::Save) {
FF_METHOD_CONTEXT("Facemark::Save");
FF_ARG_STRING(0, std::string path);
Expand Down Expand Up @@ -168,3 +170,5 @@ bool Facemark::detector(cv::InputArray image, cv::OutputArray faces,
}

#endif

#endif
6 changes: 5 additions & 1 deletion cc/modules/face/Facemark.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <iostream>
#include <opencv2/face.hpp>

#if CV_VERSION_MINOR >= 4

#ifndef __FF_FACEMARK_H__
#define __FF_FACEMARK_H__

Expand All @@ -16,7 +18,7 @@ class Facemark : public Nan::ObjectWrap {
virtual void load(std::string) = 0;

static void Init(v8::Local<v8::FunctionTemplate>);

static NAN_METHOD(AddTrainingSample);
static NAN_METHOD(AddTrainingSampleAsync);
static NAN_METHOD(LoadModel);
Expand All @@ -38,3 +40,5 @@ class Facemark : public Nan::ObjectWrap {
};

#endif

#endif
4 changes: 4 additions & 0 deletions cc/modules/face/FacemarkAAM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "FacemarkAAM.h"
#include "FacemarkAAMParams.h"

#if CV_VERSION_MINOR >= 4

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

NAN_MODULE_INIT(FacemarkAAM::Init) {
Expand Down Expand Up @@ -37,3 +39,5 @@ NAN_METHOD(FacemarkAAM::New) {
};

#endif

#endif
4 changes: 4 additions & 0 deletions cc/modules/face/FacemarkAAM.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "Facemark.h"

#if CV_VERSION_MINOR >= 4

#ifndef __FF_FACEMARKAAM_H__
#define __FF_FACEMARKAAM_H__

Expand All @@ -21,3 +23,5 @@ class FacemarkAAM : public Facemark {
};

#endif

#endif
4 changes: 4 additions & 0 deletions cc/modules/face/FacemarkAAMData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "FacemarkAAMData.h"

#if CV_VERSION_MINOR >= 4

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

NAN_MODULE_INIT(FacemarkAAMData::Init) {
Expand All @@ -27,3 +29,5 @@ NAN_METHOD(FacemarkAAMData::New) {
};

#endif

#endif
4 changes: 4 additions & 0 deletions cc/modules/face/FacemarkAAMData.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <opencv2/core.hpp>
#include <opencv2/face.hpp>

#if CV_VERSION_MINOR >= 4

#ifndef __FF_FACEMARKAAMDATA_H__
#define __FF_FACEMARKAAMDATA_H__

Expand All @@ -30,3 +32,5 @@ class FacemarkAAMData : public Nan::ObjectWrap {
FF_UNWRAP_FACEMARKAAMDATA(obj)->data

#endif

#endif
4 changes: 4 additions & 0 deletions cc/modules/face/FacemarkAAMParams.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "FacemarkAAMParams.h"

#if CV_VERSION_MINOR >= 4

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

NAN_MODULE_INIT(FacemarkAAMParams::Init) {
Expand Down Expand Up @@ -36,3 +38,5 @@ NAN_METHOD(FacemarkAAMParams::New) {
};

#endif

#endif
4 changes: 4 additions & 0 deletions cc/modules/face/FacemarkAAMParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "TypeConverters.h"
#include <opencv2/face.hpp>

#if CV_VERSION_MINOR >= 4

#ifndef __FF_FACEMARKAAMPARAMS_H__
#define __FF_FACEMARKAAMPARAMS_H__

Expand Down Expand Up @@ -41,3 +43,5 @@ class FacemarkAAMParams : public Nan::ObjectWrap {
FF_UNWRAP_FACEMARKAAMPARAMS(obj)->params

#endif

#endif
5 changes: 5 additions & 0 deletions cc/modules/face/FacemarkBindings.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "Facemark.h"
#include "FacemarkAAMData.h"

#if CV_VERSION_MINOR >= 4

#ifndef __FF_FACEMARKBINDINGS_H_
#define __FF_FACEMARKBINDINGS_H_

Expand Down Expand Up @@ -130,4 +132,7 @@ namespace FacemarkBindings {
}
};
}

#endif

#endif
4 changes: 4 additions & 0 deletions cc/modules/face/FacemarkLBF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "FacemarkLBF.h"
#include "FacemarkLBFParams.h"

#if CV_VERSION_MINOR >= 4

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

NAN_MODULE_INIT(FacemarkLBF::Init) {
Expand Down Expand Up @@ -37,3 +39,5 @@ NAN_METHOD(FacemarkLBF::New) {
};

#endif

#endif
4 changes: 4 additions & 0 deletions cc/modules/face/FacemarkLBF.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "Facemark.h"

#if CV_VERSION_MINOR >= 4

#ifndef __FF_FACEMARKLBF_H__
#define __FF_FACEMARKLBF_H__

Expand All @@ -21,3 +23,5 @@ class FacemarkLBF : public Facemark {
};

#endif

#endif
4 changes: 4 additions & 0 deletions cc/modules/face/FacemarkLBFParams.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "FacemarkLBFParams.h"

#if CV_VERSION_MINOR >= 4

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

NAN_MODULE_INIT(FacemarkLBFParams::Init) {
Expand Down Expand Up @@ -42,3 +44,5 @@ NAN_METHOD(FacemarkLBFParams::New) {
};

#endif

#endif
4 changes: 4 additions & 0 deletions cc/modules/face/FacemarkLBFParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "Rect.h"
#include <opencv2/face.hpp>

#if CV_VERSION_MINOR >= 4

#ifndef __FF_FACEMARKLBFPARAMS_H__
#define __FF_FACEMARKLBFPARAMS_H__

Expand Down Expand Up @@ -77,3 +79,5 @@ class FacemarkLBFParams : public Nan::ObjectWrap {
FF_UNWRAP_FACEMARKLBFPARAMS(obj)->params

#endif

#endif

0 comments on commit 8d04229

Please sign in to comment.