31 #include "vpTutoMeanSquareFitting.h"
33 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
37 #ifdef ENABLE_VISP_NAMESPACE
41 vpTutoMeanSquareFitting::vpTutoMeanSquareFitting(
const unsigned int °ree,
const unsigned int &height,
const unsigned int &width)
43 , m_height(static_cast<unsigned int>(height))
44 , m_width(static_cast<unsigned int>(width))
45 , m_model(degree, height, width)
50 void vpTutoMeanSquareFitting::fit(
const std::vector<vpImagePoint> &pts)
57 vpTutoParabolaModel::fillSystem(m_degree, m_height, m_width, pts, A, b);
61 m_model = vpTutoParabolaModel(X, m_height, m_width);
66 double vpTutoMeanSquareFitting::evaluate(
const std::vector<vpImagePoint> &pts)
71 unsigned int nbPts =
static_cast<unsigned int>(pts.size());
74 double meanSquareError = 0.f;
75 for (
unsigned int i = 0; i < nbPts; ++i) {
76 double squareError = evaluate(pts[i]);
77 meanSquareError += squareError;
79 meanSquareError /=
static_cast<double>(nbPts);
80 return std::sqrt(meanSquareError);
83 double vpTutoMeanSquareFitting::evaluate(
const vpImagePoint &pt)
88 double u = pt.
get_u();
89 double v = pt.
get_v();
90 double v_model = model(u);
91 double error = v - v_model;
92 double squareError = error * error;
96 double vpTutoMeanSquareFitting::model(
const double &u)
101 double v = m_model.eval(u);
107 void dummy_vpTutoMeanSquareFitting() { }
error that can be emitted by ViSP classes.
@ notInitialized
Used to indicate that a parameter is not initialized.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Implementation of a matrix and operations on matrices.
vpMatrix pseudoInverse(double svThreshold=1e-6) const