Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
vpMbtMeLine.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  * Implementation of a line used by the model-based tracker.
33  *
34  * Authors:
35  * Nicolas Melchior
36  * Romain Tallonneau
37  * Eric Marchand
38  *
39  *****************************************************************************/
40 
46 #ifndef vpMbtMeLine_HH
47 #define vpMbtMeLine_HH
48 
49 #include <visp3/core/vpPoint.h>
50 #include <visp3/me/vpMe.h>
51 #include <visp3/me/vpMeTracker.h>
52 
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
54 
61 class VISP_EXPORT vpMbtMeLine : public vpMeTracker
62 {
63 private:
64  vpMeSite PExt[2];
65  double rho, theta, theta_1;
66  double delta, delta_1;
67  int sign;
68  double a, b, c;
69 
70 public:
71  int imin, imax;
72  int jmin, jmax;
73  double expecteddensity;
74 
75 public:
76  vpMbtMeLine();
77  virtual ~vpMbtMeLine();
78 
79  void computeProjectionError(const vpImage<unsigned char> &_I, double &_sumErrorRad, unsigned int &_nbFeatures,
80  const vpMatrix &SobelX, const vpMatrix &SobelY, const bool display,
81  const unsigned int length, const unsigned int thickness);
82 
83  void display(const vpImage<unsigned char> & /*I*/, vpColor /*col*/) { ; }
84  void display(const vpImage<unsigned char> &I)
85  {
87  } // Shouldn't be here since it's already in vpMeTracker
88 
95  inline double get_a() const { return this->a; }
96 
103  inline double get_b() const { return this->b; }
104 
111  inline double get_c() const { return this->c; }
112 
113  void initTracking(const vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, double rho,
114  double theta, const bool doNoTrack);
115 
116  void track(const vpImage<unsigned char> &I);
117 
118  void updateParameters(const vpImage<unsigned char> &I, double rho, double theta);
119  void updateParameters(const vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, double rho,
120  double theta);
121 
122 private:
123  void bubbleSortI();
124  void bubbleSortJ();
125  virtual void sample(const vpImage<unsigned char> &image, const bool doNotTrack = false);
126  void seekExtremities(const vpImage<unsigned char> &I);
127  void setExtremities();
128  void suppressPoints(const vpImage<unsigned char> &I);
129  void reSample(const vpImage<unsigned char> &image);
130  void reSample(const vpImage<unsigned char> &image, const vpImagePoint &ip1, const vpImagePoint &ip2);
131  void updateDelta();
132 };
133 
134 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
135 
136 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:104
Performs search in a given direction(normal) for a given distance(pixels) for a given &#39;site&#39;...
Definition: vpMeSite.h:71
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