Skip to content

Commit

Permalink
Enabled 9 algorithms compatible with OpenCV 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewssobral committed Mar 4, 2023
1 parent 8284dee commit d21861b
Show file tree
Hide file tree
Showing 20 changed files with 4 additions and 93 deletions.
4 changes: 0 additions & 4 deletions bgslibrary/algorithms/FuzzyChoquetIntegral.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "FuzzyChoquetIntegral.h"

#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3

using namespace bgslibrary::algorithms;

FuzzyChoquetIntegral::FuzzyChoquetIntegral() :
Expand Down Expand Up @@ -189,5 +187,3 @@ void FuzzyChoquetIntegral::load_config(cv::FileStorage &fs) {
fs["smooth"] >> smooth;
fs["showOutput"] >> showOutput;
}

#endif
6 changes: 0 additions & 6 deletions bgslibrary/algorithms/FuzzyChoquetIntegral.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#pragma once

#include "IBGS.h"

#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION == 2 || CV_MAJOR_VERSION == 3

#include "../tools/FuzzyUtils.h"

namespace bgslibrary
Expand Down Expand Up @@ -39,5 +35,3 @@ namespace bgslibrary
bgs_register(FuzzyChoquetIntegral);
}
}

#endif
4 changes: 0 additions & 4 deletions bgslibrary/algorithms/FuzzySugenoIntegral.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "FuzzySugenoIntegral.h"

#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3

using namespace bgslibrary::algorithms;

FuzzySugenoIntegral::FuzzySugenoIntegral() :
Expand Down Expand Up @@ -188,5 +186,3 @@ void FuzzySugenoIntegral::load_config(cv::FileStorage &fs) {
fs["smooth"] >> smooth;
fs["showOutput"] >> showOutput;
}

#endif
6 changes: 0 additions & 6 deletions bgslibrary/algorithms/FuzzySugenoIntegral.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#pragma once

#include "IBGS.h"

#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION == 2 || CV_MAJOR_VERSION == 3

#include "../tools/FuzzyUtils.h"

namespace bgslibrary
Expand Down Expand Up @@ -39,5 +35,3 @@ namespace bgslibrary
bgs_register(FuzzySugenoIntegral);
}
}

#endif
4 changes: 0 additions & 4 deletions bgslibrary/algorithms/IndependentMultimodal.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "IndependentMultimodal.h"

#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3

using namespace bgslibrary::algorithms;

IndependentMultimodal::IndependentMultimodal() :
Expand Down Expand Up @@ -49,5 +47,3 @@ void IndependentMultimodal::load_config(cv::FileStorage &fs) {
fs["fps"] >> fps;
fs["showOutput"] >> showOutput;
}

#endif
6 changes: 0 additions & 6 deletions bgslibrary/algorithms/IndependentMultimodal.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#pragma once

#include "IBGS.h"

#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION == 2 || CV_MAJOR_VERSION == 3

#include "IMBS/IMBS.hpp"

namespace bgslibrary
Expand All @@ -31,5 +27,3 @@ namespace bgslibrary
bgs_register(IndependentMultimodal);
}
}

#endif
4 changes: 0 additions & 4 deletions bgslibrary/algorithms/KDE.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "KDE.h"

#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3

using namespace bgslibrary::algorithms;

KDE::KDE() :
Expand Down Expand Up @@ -104,5 +102,3 @@ void KDE::load_config(cv::FileStorage &fs) {
fs["alpha"] >> alpha;
fs["showOutput"] >> showOutput;
}

#endif
6 changes: 0 additions & 6 deletions bgslibrary/algorithms/KDE.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#pragma once

#include "IBGS.h"

#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION == 2 || CV_MAJOR_VERSION == 3

#include "KDE/NPBGSubtractor.h"

namespace bgslibrary
Expand Down Expand Up @@ -45,5 +41,3 @@ namespace bgslibrary
bgs_register(KDE);
}
}

#endif
4 changes: 0 additions & 4 deletions bgslibrary/algorithms/LBAdaptiveSOM.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "LBAdaptiveSOM.h"

#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3

using namespace bgslibrary::algorithms;

LBAdaptiveSOM::LBAdaptiveSOM() :
Expand Down Expand Up @@ -76,5 +74,3 @@ void LBAdaptiveSOM::load_config(cv::FileStorage &fs) {
fs["trainingSteps"] >> trainingSteps;
fs["showOutput"] >> showOutput;
}

#endif
6 changes: 0 additions & 6 deletions bgslibrary/algorithms/LBAdaptiveSOM.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#pragma once

#include "IBGS.h"

#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION == 2 || CV_MAJOR_VERSION == 3

#include "lb/BGModelSom.h"

namespace bgslibrary
Expand Down Expand Up @@ -35,5 +31,3 @@ namespace bgslibrary
bgs_register(LBAdaptiveSOM);
}
}

#endif
4 changes: 0 additions & 4 deletions bgslibrary/algorithms/LBFuzzyAdaptiveSOM.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "LBFuzzyAdaptiveSOM.h"

#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3

using namespace bgslibrary::algorithms;

LBFuzzyAdaptiveSOM::LBFuzzyAdaptiveSOM() :
Expand Down Expand Up @@ -75,5 +73,3 @@ void LBFuzzyAdaptiveSOM::load_config(cv::FileStorage &fs) {
fs["trainingSteps"] >> trainingSteps;
fs["showOutput"] >> showOutput;
}

#endif
6 changes: 0 additions & 6 deletions bgslibrary/algorithms/LBFuzzyAdaptiveSOM.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#pragma once

#include "IBGS.h"

#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION == 2 || CV_MAJOR_VERSION == 3

#include "lb/BGModelFuzzySom.h"

namespace bgslibrary
Expand Down Expand Up @@ -35,5 +31,3 @@ namespace bgslibrary
bgs_register(LBFuzzyAdaptiveSOM);
}
}

#endif
4 changes: 0 additions & 4 deletions bgslibrary/algorithms/LBFuzzyGaussian.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "LBFuzzyGaussian.h"

#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3

using namespace bgslibrary::algorithms;

LBFuzzyGaussian::LBFuzzyGaussian() :
Expand Down Expand Up @@ -72,5 +70,3 @@ void LBFuzzyGaussian::load_config(cv::FileStorage &fs) {
fs["noiseVariance"] >> noiseVariance;
fs["showOutput"] >> showOutput;
}

#endif
6 changes: 0 additions & 6 deletions bgslibrary/algorithms/LBFuzzyGaussian.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#pragma once

#include "IBGS.h"

#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION == 2 || CV_MAJOR_VERSION == 3

#include "lb/BGModelFuzzyGauss.h"

namespace bgslibrary
Expand Down Expand Up @@ -34,5 +30,3 @@ namespace bgslibrary
bgs_register(LBFuzzyGaussian);
}
}

#endif
4 changes: 0 additions & 4 deletions bgslibrary/algorithms/LBSimpleGaussian.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "LBSimpleGaussian.h"

#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3

using namespace bgslibrary::algorithms;

LBSimpleGaussian::LBSimpleGaussian() :
Expand Down Expand Up @@ -68,5 +66,3 @@ void LBSimpleGaussian::load_config(cv::FileStorage &fs) {
fs["learningRate"] >> learningRate;
fs["showOutput"] >> showOutput;
}

#endif
6 changes: 0 additions & 6 deletions bgslibrary/algorithms/LBSimpleGaussian.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#pragma once

#include "IBGS.h"

#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION == 2 || CV_MAJOR_VERSION == 3

#include "lb/BGModelGauss.h"

namespace bgslibrary
Expand Down Expand Up @@ -33,5 +29,3 @@ namespace bgslibrary
bgs_register(LBSimpleGaussian);
}
}

#endif
4 changes: 0 additions & 4 deletions bgslibrary/algorithms/VuMeter.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "VuMeter.h"

#if CV_MAJOR_VERSION >= 2 && CV_MAJOR_VERSION <= 3

using namespace bgslibrary::algorithms;

VuMeter::VuMeter() :
Expand Down Expand Up @@ -85,5 +83,3 @@ void VuMeter::load_config(cv::FileStorage &fs) {
fs["threshold"] >> threshold;
fs["showOutput"] >> showOutput;
}

#endif
5 changes: 0 additions & 5 deletions bgslibrary/algorithms/VuMeter.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#pragma once

#include "opencv2/core/version.hpp"
#if CV_MAJOR_VERSION == 2 || CV_MAJOR_VERSION == 3

#include "IBGS.h"
#include "VuMeter/TBackgroundVuMeter.h"

Expand Down Expand Up @@ -37,5 +34,3 @@ namespace bgslibrary
bgs_register(VuMeter);
}
}

#endif
2 changes: 1 addition & 1 deletion bgslibrary/algorithms/algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
#include "ViBe.h"
#include "CodeBook.h"

//#include "_template_/MyBGS.h"
// #include "_template_/MyBGS.h"

using namespace bgslibrary::algorithms;
6 changes: 3 additions & 3 deletions bgslibrary/algorithms/lb/BGModelSom.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace bgslibrary
const int M = 3; // width SOM (per pixel)
const int N = 3; // height SOM (per pixel)
const int KERNEL = 3; // size Gaussian kernel
const bool SPAN_NEIGHBORS = false; // true if update neighborhood spans different pixels //
const bool SPAN_NEIGHBORS = false; // true if update neighborhood spans different pixels
const int TRAINING_STEPS = 100; // number of training steps
const float EPS1 = 100.0; // model match distance during training
const float EPS2 = 20.0; // model match distance
Expand Down Expand Up @@ -43,8 +43,8 @@ namespace bgslibrary
double m_alpha1;
double m_alpha2;

DBLRGB** m_ppSOM; // SOM grid
double** m_ppW; // Weights
DBLRGB** m_ppSOM; // SOM grid
double** m_ppW; // Weights

void Init();
void Update();
Expand Down

0 comments on commit d21861b

Please sign in to comment.