48 #include <visp3/core/vpDebug.h> 49 #include <visp3/core/vpHinkley.h> 51 #include <visp3/core/vpMath.h> 95 : dmin2(delta_val / 2.), alpha(alpha_val), nsignal(0), mean(0), Sk(0), Mk(0), Tk(0), Nk(0)
189 vpCDEBUG(2) <<
"alpha: " << alpha <<
" dmin2: " << dmin2 <<
" signal: " << signal <<
" Sk: " << Sk <<
" Mk: " << Mk;
192 if ((Mk - Sk) > alpha)
196 if (VP_DEBUG_MODE >= 2) {
199 std::cout <<
"noJump " << std::endl;
202 std::cout <<
"downWardJump " << std::endl;
205 std::cout <<
"upwardJump " << std::endl;
214 vpCDEBUG(2) <<
"\n*** Reset the Hinkley test ***\n";
249 vpCDEBUG(2) <<
"alpha: " << alpha <<
" dmin2: " << dmin2 <<
" signal: " << signal <<
" Tk: " << Tk <<
" Nk: " << Nk;
252 if ((Tk - Nk) > alpha)
256 if (VP_DEBUG_MODE >= 2) {
259 std::cout <<
"noJump " << std::endl;
262 std::cout <<
"downWardJump " << std::endl;
265 std::cout <<
"upWardJump " << std::endl;
273 vpCDEBUG(2) <<
"\n*** Reset the Hinkley test ***\n";
310 vpCDEBUG(2) <<
"alpha: " << alpha <<
" dmin2: " << dmin2 <<
" signal: " << signal <<
" Sk: " << Sk <<
" Mk: " << Mk
311 <<
" Tk: " << Tk <<
" Nk: " << Nk << std::endl;
314 if ((Mk - Sk) > alpha)
316 else if ((Tk - Nk) > alpha)
320 if (VP_DEBUG_MODE >= 2) {
323 std::cout <<
"noJump " << std::endl;
326 std::cout <<
"downWardJump " << std::endl;
329 std::cout <<
"upwardJump " << std::endl;
338 vpCDEBUG(2) <<
"\n*** Reset the Hinkley test ***\n";
361 void vpHinkley::computeMean(
double signal)
369 if ((std::fabs(Mk - Sk) <= std::fabs(
vpMath::maximum(Mk, Sk)) * std::numeric_limits<double>::epsilon()) &&
370 (std::fabs(Tk - Nk) <= std::fabs(
vpMath::maximum(Tk, Nk)) * std::numeric_limits<double>::epsilon()))
374 mean = (mean * (nsignal - 1) + signal) / (nsignal);
383 void vpHinkley::computeSk(
double signal)
387 Sk += signal - mean + dmin2;
394 void vpHinkley::computeMk()
405 void vpHinkley::computeTk(
double signal)
409 Tk += signal - mean - dmin2;
416 void vpHinkley::computeNk()
426 std::cout <<
" No jump detected " << std::endl;
429 std::cout <<
" Jump downward detected " << std::endl;
432 std::cout <<
" Jump upward detected " << std::endl;
435 std::cout <<
" Jump detected " << std::endl;
vpHinkleyJumpType testDownUpwardJump(double signal)
vpHinkleyJumpType testUpwardJump(double signal)
static Type maximum(const Type &a, const Type &b)
static void print(vpHinkleyJumpType jump)
vpHinkleyJumpType testDownwardJump(double signal)
void init(double alpha, double delta)
void setAlpha(double alpha)
void setDelta(double delta)