38 const std::vector<float>&
data,
39 const std::vector<float>& newTimestamps)
43 std::vector<float> result;
44 result.reserve(
data.size());
52 result.push_back(
data.at(0));
59 while (j <
data.size())
61 while (newTimestamps.at(j) > timestamps.at(i + 1) && i <
data.size() - 2)
76 const std::vector<float>& filter,
79 std::vector<float> result;
80 size_t start = filter.size() / 2;
81 for (
size_t i = start; i <
data.size() + start; i++)
85 for (
size_t j = 0; j < filter.size(); j++)
87 int k = (int)i - (
int)j;
92 if (k >= (
int)
data.size())
96 y +=
data.at(k) * filter.at(j);
99 result.push_back(w == 0 ? 0 : y / w);
117 std::vector<float> filter;
118 int range = (int)(truncate * sigma / sampleTime);
119 for (
int i = -range; i <= range; i++)
121 float x = i * sampleTime;
122 filter.push_back(exp(-
x *
x / (2 * sigma * sigma) / (sigma * sqrt(2 *
M_PI))));
130 std::vector<float> result;
131 for (
size_t i = 0; i < count; i++)
133 result.push_back(
MathUtils::Lerp(start, end, (
float)i / (
float)(count - 1)));
static float Lerp(float a, float b, float f)
static float LerpClamp(float a, float b, float f)
static float ILerp(float a, float b, float f)
static std::vector< float > CreateGaussianFilter(const float sigma, float sampleTime, float truncate=4)
static std::vector< float > Resample(const std::vector< float > ×tamps, const std::vector< float > &data, const std::vector< float > &newTimestamps)
static std::vector< float > ApplyFilter(const std::vector< float > &data, const std::vector< float > &filter, BorderMode mode)
static std::vector< float > MakeTimestamps(float start, float end, size_t count)
static std::vector< float > ApplyGaussianFilter(const std::vector< float > &data, float sigma, float sampleTime, BorderMode mode)
#define ARMARX_CHECK_EQUAL(lhs, rhs)
This macro evaluates whether lhs is equal (==) rhs and if it turns out to be false it will throw an E...
This file offers overloads of toIce() and fromIce() functions for STL container types.