31#ifndef VP_TUTO_MEAN_SQUARE_FITTING_H
32#define VP_TUTO_MEAN_SQUARE_FITTING_H
34#include <visp3/core/vpConfig.h>
35#include <visp3/core/vpDisplay.h>
36#include <visp3/core/vpImagePoint.h>
37#include <visp3/core/vpMatrix.h>
38#include <visp3/core/vpRobust.h>
40#include "vpTutoParabolaModel.h"
42#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
43#ifndef DOXYGEN_SHOULD_SKIP_THIS
50class vpTutoMeanSquareFitting
60 vpTutoMeanSquareFitting(
const unsigned int °ree,
const unsigned int &height,
const unsigned int &width);
68 void fit(
const std::vector<VISP_NAMESPACE_ADDRESSING vpImagePoint> &pts);
76 double evaluate(
const std::vector<VISP_NAMESPACE_ADDRESSING vpImagePoint> &pts);
84 double evaluate(
const VISP_NAMESPACE_ADDRESSING vpImagePoint &pt);
94 double model(
const double &u);
96#ifdef VISP_HAVE_DISPLAY
107 void display(
const VISP_NAMESPACE_ADDRESSING vpImage<T> &I,
const VISP_NAMESPACE_ADDRESSING vpColor &color,
108 const unsigned int &vertPosLegend,
const unsigned int &horPosLegend)
111 for (
unsigned int u = 0;
u <
width; ++
u) {
112 int v =
static_cast<int>(model(u));
114 VISP_NAMESPACE_ADDRESSING
vpDisplay::displayText(I, vertPosLegend, horPosLegend,
"Least-mean square model", color);
127 inline vpTutoMeanSquareFitting &operator=(
const vpTutoMeanSquareFitting &other)
129 m_model = other.m_model;
130 m_isFitted = other.m_isFitted;
139 inline VISP_NAMESPACE_ADDRESSING vpColVector getCoeffs()
const
141 return m_model.toVpColVector();
149 inline const vpTutoParabolaModel &getModel()
const
155 unsigned int m_degree;
156 unsigned int m_height;
157 unsigned int m_width;
158 vpTutoParabolaModel m_model;
static void displayPoint(const vpImage< unsigned char > &I, const vpImagePoint &ip, const vpColor &color, unsigned int thickness=1)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
unsigned int getWidth() const