Visual Servoing Platform  version 3.3.0 under development (2020-02-17)
vpMbtMeEllipse.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Moving edges.
33  *
34  * Authors:
35  * Eric Marchand
36  *
37  *****************************************************************************/
38 
44 #ifndef vpMbtMeEllipse_HH
45 #define vpMbtMeEllipse_HH
46 
47 #include <visp3/core/vpColVector.h>
48 #include <visp3/core/vpMatrix.h>
49 
50 #include <visp3/core/vpImagePoint.h>
51 #include <visp3/me/vpMeSite.h>
52 #include <visp3/me/vpMeTracker.h>
53 
54 #include <visp3/core/vpColor.h>
55 #include <visp3/core/vpImage.h>
56 
57 #include <list>
58 #include <math.h>
59 
60 #ifndef DOXYGEN_SHOULD_SKIP_THIS
61 
149 class VISP_EXPORT vpMbtMeEllipse : public vpMeTracker
150 {
151 public:
152  vpMbtMeEllipse();
153  vpMbtMeEllipse(const vpMbtMeEllipse &meellipse);
154  virtual ~vpMbtMeEllipse();
155 
156  void computeProjectionError(const vpImage<unsigned char> &_I, double &_sumErrorRad, unsigned int &_nbFeatures,
157  const vpMatrix &SobelX, const vpMatrix &SobelY, bool display,
158  unsigned int length, unsigned int thickness);
159 
160  void display(const vpImage<unsigned char> &I, vpColor col);
161  using vpMeTracker::display;
162 
163  int getExpectedDensity() { return (int)expecteddensity; }
164 
170  inline double get_mu11() const { return mu11; }
171 
177  inline double get_mu02() const { return mu02; }
178 
184  inline double get_mu20() const { return mu20; }
185 
189  inline vpImagePoint getCenter() const { return iPc; }
190 
194  inline double getA() const { return a; }
195 
199  inline double getB() const { return b; }
200 
205  inline double getE() const { return e; }
206 
210  void getEquationParam(double &A, double &B, double &E)
211  {
212  A = a;
213  B = b;
214  E = e;
215  }
216 
217  void initTracking(const vpImage<unsigned char> &I, const vpImagePoint &ic, double mu20_p, double mu11_p,
218  double mu02_p, bool doNotTrack);
219 
220  void track(const vpImage<unsigned char> &I);
221 
222  void updateParameters(const vpImage<unsigned char> &I, const vpImagePoint &ic, double mu20_p, double mu11_p,
223  double mu02_p);
224 
225 protected:
227  vpImagePoint iPc;
229  double a;
231  double b;
234  double e;
235 
236 protected:
238  double ce;
240  double se;
241 
243  double mu11, mu20, mu02;
245  double thresholdWeight;
247  double expecteddensity;
248 
249 private:
250  virtual void sample(const vpImage<unsigned char> &image, bool doNotTrack=false);
251  void reSample(const vpImage<unsigned char> &I);
252  void updateTheta();
253  void suppressPoints();
254 };
255 
256 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
257 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:164
Class to define colors available for display functionnalities.
Definition: vpColor.h:119
void track(const vpImage< unsigned char > &I)
Track sampled pixels.
Contains abstract elements for a Distance to Feature type feature.
Definition: vpMeTracker.h:65
virtual void sample(const vpImage< unsigned char > &image, bool doNotTrack=false)=0
Sample pixels at a given interval.
void initTracking(const vpImage< unsigned char > &I)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88
virtual void display(const vpImage< unsigned char > &I, vpColor col)=0