Added window size calculations for filter
This commit is contained in:
parent
825212a3e5
commit
ce95fe95ca
35
main.cpp
35
main.cpp
@ -11,8 +11,37 @@
|
||||
|
||||
#include "Euclidean.hpp"
|
||||
|
||||
#define MIN(x,y) ((x)<(y)?(x):(y))
|
||||
#define MAX(x,y) ((x)>(y)?(x):(y))
|
||||
|
||||
using namespace cimg_library;
|
||||
|
||||
double min(std::vector<Euclidean> vect) {
|
||||
double min = (*vect.begin()).getDistance();
|
||||
std::vector<Euclidean>::iterator it;
|
||||
|
||||
for (it = vect.begin() + 1; it != vect.end(); it++) {
|
||||
if ((*it).getDistance() < min) {
|
||||
min = (*it).getDistance();
|
||||
}
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
double max(std::vector<Euclidean> vect) {
|
||||
double max = (*vect.begin()).getDistance();
|
||||
std::vector<Euclidean>::iterator it;
|
||||
|
||||
for (it = vect.begin() + 1; it != vect.end(); it++) {
|
||||
if ((*it).getDistance() > max) {
|
||||
max = (*it).getDistance();
|
||||
}
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Main
|
||||
*******************************************************************************/
|
||||
@ -121,6 +150,12 @@ int main()
|
||||
}
|
||||
|
||||
// Calculate the window size
|
||||
double d1 = MIN(min(vectEMax), min(vectEMin));
|
||||
double d2 = MAX(min(vectEMax), min(vectEMin));
|
||||
double d3 = MIN(max(vectEMax), max(vectEMin));
|
||||
double d4 = MAX(max(vectEMax), max(vectEMin));
|
||||
|
||||
int w = ((int)ceil(MIN(MIN(d1, d2), MIN(d3, d4)))) % 2 ? w + 1 : w;
|
||||
|
||||
// Order filters with source image
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user