Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
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, const bool display,
158  const unsigned int length, const unsigned int thickness);
159 
160  void display(const vpImage<unsigned char> &I, vpColor col);
161  void display(const vpImage<unsigned char> &I)
162  {
164  } // Shouldn't be here since it's already in vpMeTracker
168  int getExpectedDensity() { return (int)expecteddensity; }
169 
175  inline double get_mu11() const { return mu11; }
176 
182  inline double get_mu02() const { return mu02; }
183 
189  inline double get_mu20() const { return mu20; }
190 
194  inline vpImagePoint getCenter() const { return iPc; }
195 
199  inline double getA() const { return a; }
200 
204  inline double getB() const { return b; }
205 
210  inline double getE() const { return e; }
211 
215  void getEquationParam(double &A, double &B, double &E)
216  {
217  A = a;
218  B = b;
219  E = e;
220  }
221 
222  void initTracking(const vpImage<unsigned char> &I, const vpImagePoint &ic, double mu20_p, double mu11_p,
223  double mu02_p, const bool doNotTrack);
224 
225  void track(const vpImage<unsigned char> &I);
226 
227  void updateParameters(const vpImage<unsigned char> &I, const vpImagePoint &ic, double mu20_p, double mu11_p,
228  double mu02_p);
229 
230 protected:
232  vpImagePoint iPc;
234  double a;
236  double b;
239  double e;
240 
241 protected:
243  double ce;
245  double se;
246 
248  double mu11, mu20, mu02;
250  double thresholdWeight;
252  double expecteddensity;
253 
254 private:
255  virtual void sample(const vpImage<unsigned char> &image, const bool doNotTrack=false);
256  void reSample(const vpImage<unsigned char> &I);
257  void updateTheta();
258  void suppressPoints();
259 };
260 
261 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
262 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:104
Class to define colors available for display functionnalities.
Definition: vpColor.h:120
virtual void sample(const vpImage< unsigned char > &image, const bool doNotTrack=false)=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