Visual Servoing Platform  version 3.1.0
vpMbtMeEllipse.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 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 
158  void display(const vpImage<unsigned char> &I, vpColor col);
159  void display(const vpImage<unsigned char> &I)
160  {
162  } // Shouldn't be here since it's already in vpMeTracker
166  int getExpectedDensity() { return (int)expecteddensity; }
167 
173  inline double get_mu11() const { return mu11; }
174 
180  inline double get_mu02() const { return mu02; }
181 
187  inline double get_mu20() const { return mu20; }
188 
192  inline vpImagePoint getCenter() const { return iPc; }
193 
197  inline double getA() const { return a; }
198 
202  inline double getB() const { return b; }
203 
208  inline double getE() const { return e; }
209 
213  void getEquationParam(double &A, double &B, double &E)
214  {
215  A = a;
216  B = b;
217  E = e;
218  }
219 
220  void initTracking(const vpImage<unsigned char> &I, const vpImagePoint &ic, double mu20_p, double mu11_p,
221  double mu02_p);
222 
223  void track(const vpImage<unsigned char> &Im);
224 
225  void updateParameters(const vpImage<unsigned char> &I, const vpImagePoint &ic, double mu20_p, double mu11_p,
226  double mu02_p);
227 
228 protected:
230  vpImagePoint iPc;
232  double a;
234  double b;
237  double e;
238 
239 protected:
241  double ce;
243  double se;
244 
246  double mu11, mu20, mu02;
248  double thresholdWeight;
250  double expecteddensity;
251 
252 private:
253  void sample(const vpImage<unsigned char> &image);
254  void reSample(const vpImage<unsigned char> &I);
255  void updateTheta();
256  void suppressPoints();
257 };
258 
259 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
260 #endif
Class to define colors available for display functionnalities.
Definition: vpColor.h:120
virtual void sample(const vpImage< unsigned char > &image)=0
Sample pixels at a given interval.
void track(const vpImage< unsigned char > &I)
Track sampled pixels.
Contains abstract elements for a Distance to Feature type feature.
Definition: vpMeTracker.h:65
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