From 8d042295203f5cc2fdc0f36946b9d789d7313953 Mon Sep 17 00:00:00 2001 From: Nicholas Charbonneau Date: Tue, 24 Apr 2018 14:08:51 -0400 Subject: [PATCH] Facemark API fix build for older contrib versions --- cc/modules/face/Facemark.cc | 4 ++++ cc/modules/face/Facemark.h | 6 +++++- cc/modules/face/FacemarkAAM.cc | 4 ++++ cc/modules/face/FacemarkAAM.h | 4 ++++ cc/modules/face/FacemarkAAMData.cc | 4 ++++ cc/modules/face/FacemarkAAMData.h | 4 ++++ cc/modules/face/FacemarkAAMParams.cc | 4 ++++ cc/modules/face/FacemarkAAMParams.h | 4 ++++ cc/modules/face/FacemarkBindings.h | 5 +++++ cc/modules/face/FacemarkLBF.cc | 4 ++++ cc/modules/face/FacemarkLBF.h | 4 ++++ cc/modules/face/FacemarkLBFParams.cc | 4 ++++ cc/modules/face/FacemarkLBFParams.h | 4 ++++ 13 files changed, 54 insertions(+), 1 deletion(-) diff --git a/cc/modules/face/Facemark.cc b/cc/modules/face/Facemark.cc index 277403e0a..70d478fd7 100644 --- a/cc/modules/face/Facemark.cc +++ b/cc/modules/face/Facemark.cc @@ -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); @@ -168,3 +170,5 @@ bool Facemark::detector(cv::InputArray image, cv::OutputArray faces, } #endif + +#endif diff --git a/cc/modules/face/Facemark.h b/cc/modules/face/Facemark.h index b6b536fe3..43de3cd27 100644 --- a/cc/modules/face/Facemark.h +++ b/cc/modules/face/Facemark.h @@ -6,6 +6,8 @@ #include #include +#if CV_VERSION_MINOR >= 4 + #ifndef __FF_FACEMARK_H__ #define __FF_FACEMARK_H__ @@ -16,7 +18,7 @@ class Facemark : public Nan::ObjectWrap { virtual void load(std::string) = 0; static void Init(v8::Local); - + static NAN_METHOD(AddTrainingSample); static NAN_METHOD(AddTrainingSampleAsync); static NAN_METHOD(LoadModel); @@ -38,3 +40,5 @@ class Facemark : public Nan::ObjectWrap { }; #endif + +#endif diff --git a/cc/modules/face/FacemarkAAM.cc b/cc/modules/face/FacemarkAAM.cc index eeb1cac1b..ef0085694 100644 --- a/cc/modules/face/FacemarkAAM.cc +++ b/cc/modules/face/FacemarkAAM.cc @@ -3,6 +3,8 @@ #include "FacemarkAAM.h" #include "FacemarkAAMParams.h" +#if CV_VERSION_MINOR >= 4 + Nan::Persistent FacemarkAAM::constructor; NAN_MODULE_INIT(FacemarkAAM::Init) { @@ -37,3 +39,5 @@ NAN_METHOD(FacemarkAAM::New) { }; #endif + +#endif diff --git a/cc/modules/face/FacemarkAAM.h b/cc/modules/face/FacemarkAAM.h index 56677fd1e..61351e25e 100644 --- a/cc/modules/face/FacemarkAAM.h +++ b/cc/modules/face/FacemarkAAM.h @@ -1,5 +1,7 @@ #include "Facemark.h" +#if CV_VERSION_MINOR >= 4 + #ifndef __FF_FACEMARKAAM_H__ #define __FF_FACEMARKAAM_H__ @@ -21,3 +23,5 @@ class FacemarkAAM : public Facemark { }; #endif + +#endif diff --git a/cc/modules/face/FacemarkAAMData.cc b/cc/modules/face/FacemarkAAMData.cc index efc3c3ee6..213296156 100644 --- a/cc/modules/face/FacemarkAAMData.cc +++ b/cc/modules/face/FacemarkAAMData.cc @@ -2,6 +2,8 @@ #include "FacemarkAAMData.h" +#if CV_VERSION_MINOR >= 4 + Nan::Persistent FacemarkAAMData::constructor; NAN_MODULE_INIT(FacemarkAAMData::Init) { @@ -27,3 +29,5 @@ NAN_METHOD(FacemarkAAMData::New) { }; #endif + +#endif diff --git a/cc/modules/face/FacemarkAAMData.h b/cc/modules/face/FacemarkAAMData.h index 56bfa6716..4d8b59465 100644 --- a/cc/modules/face/FacemarkAAMData.h +++ b/cc/modules/face/FacemarkAAMData.h @@ -4,6 +4,8 @@ #include #include +#if CV_VERSION_MINOR >= 4 + #ifndef __FF_FACEMARKAAMDATA_H__ #define __FF_FACEMARKAAMDATA_H__ @@ -30,3 +32,5 @@ class FacemarkAAMData : public Nan::ObjectWrap { FF_UNWRAP_FACEMARKAAMDATA(obj)->data #endif + +#endif diff --git a/cc/modules/face/FacemarkAAMParams.cc b/cc/modules/face/FacemarkAAMParams.cc index 93b1f4c05..9a30c0d98 100644 --- a/cc/modules/face/FacemarkAAMParams.cc +++ b/cc/modules/face/FacemarkAAMParams.cc @@ -2,6 +2,8 @@ #include "FacemarkAAMParams.h" +#if CV_VERSION_MINOR >= 4 + Nan::Persistent FacemarkAAMParams::constructor; NAN_MODULE_INIT(FacemarkAAMParams::Init) { @@ -36,3 +38,5 @@ NAN_METHOD(FacemarkAAMParams::New) { }; #endif + +#endif diff --git a/cc/modules/face/FacemarkAAMParams.h b/cc/modules/face/FacemarkAAMParams.h index 9c43ce0db..01282c60b 100644 --- a/cc/modules/face/FacemarkAAMParams.h +++ b/cc/modules/face/FacemarkAAMParams.h @@ -2,6 +2,8 @@ #include "TypeConverters.h" #include +#if CV_VERSION_MINOR >= 4 + #ifndef __FF_FACEMARKAAMPARAMS_H__ #define __FF_FACEMARKAAMPARAMS_H__ @@ -41,3 +43,5 @@ class FacemarkAAMParams : public Nan::ObjectWrap { FF_UNWRAP_FACEMARKAAMPARAMS(obj)->params #endif + +#endif diff --git a/cc/modules/face/FacemarkBindings.h b/cc/modules/face/FacemarkBindings.h index b6f53a9e0..57656b9d3 100644 --- a/cc/modules/face/FacemarkBindings.h +++ b/cc/modules/face/FacemarkBindings.h @@ -1,6 +1,8 @@ #include "Facemark.h" #include "FacemarkAAMData.h" +#if CV_VERSION_MINOR >= 4 + #ifndef __FF_FACEMARKBINDINGS_H_ #define __FF_FACEMARKBINDINGS_H_ @@ -130,4 +132,7 @@ namespace FacemarkBindings { } }; } + +#endif + #endif diff --git a/cc/modules/face/FacemarkLBF.cc b/cc/modules/face/FacemarkLBF.cc index a7e736964..2ba5fcd3b 100644 --- a/cc/modules/face/FacemarkLBF.cc +++ b/cc/modules/face/FacemarkLBF.cc @@ -3,6 +3,8 @@ #include "FacemarkLBF.h" #include "FacemarkLBFParams.h" +#if CV_VERSION_MINOR >= 4 + Nan::Persistent FacemarkLBF::constructor; NAN_MODULE_INIT(FacemarkLBF::Init) { @@ -37,3 +39,5 @@ NAN_METHOD(FacemarkLBF::New) { }; #endif + +#endif diff --git a/cc/modules/face/FacemarkLBF.h b/cc/modules/face/FacemarkLBF.h index 1de44fe4c..ab621ecd9 100644 --- a/cc/modules/face/FacemarkLBF.h +++ b/cc/modules/face/FacemarkLBF.h @@ -1,5 +1,7 @@ #include "Facemark.h" +#if CV_VERSION_MINOR >= 4 + #ifndef __FF_FACEMARKLBF_H__ #define __FF_FACEMARKLBF_H__ @@ -21,3 +23,5 @@ class FacemarkLBF : public Facemark { }; #endif + +#endif diff --git a/cc/modules/face/FacemarkLBFParams.cc b/cc/modules/face/FacemarkLBFParams.cc index 77f2cdf7c..1dc97ada5 100644 --- a/cc/modules/face/FacemarkLBFParams.cc +++ b/cc/modules/face/FacemarkLBFParams.cc @@ -2,6 +2,8 @@ #include "FacemarkLBFParams.h" +#if CV_VERSION_MINOR >= 4 + Nan::Persistent FacemarkLBFParams::constructor; NAN_MODULE_INIT(FacemarkLBFParams::Init) { @@ -42,3 +44,5 @@ NAN_METHOD(FacemarkLBFParams::New) { }; #endif + +#endif diff --git a/cc/modules/face/FacemarkLBFParams.h b/cc/modules/face/FacemarkLBFParams.h index 2a25fb85b..bb3cd86f1 100644 --- a/cc/modules/face/FacemarkLBFParams.h +++ b/cc/modules/face/FacemarkLBFParams.h @@ -4,6 +4,8 @@ #include "Rect.h" #include +#if CV_VERSION_MINOR >= 4 + #ifndef __FF_FACEMARKLBFPARAMS_H__ #define __FF_FACEMARKLBFPARAMS_H__ @@ -77,3 +79,5 @@ class FacemarkLBFParams : public Nan::ObjectWrap { FF_UNWRAP_FACEMARKLBFPARAMS(obj)->params #endif + +#endif