Visual Servoing Platform  version 3.5.1 under development (2022-10-02)
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, bool display, unsigned int length,
81  unsigned int thickness);
82 
83  void display(const vpImage<unsigned char> & /*I*/, vpColor /*col*/) { ; }
85 
92  inline double get_a() const { return this->a; }
93 
100  inline double get_b() const { return this->b; }
101 
108  inline double get_c() const { return this->c; }
109 
110  void initTracking(const vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, double rho,
111  double theta, bool doNoTrack);
112 
113  void track(const vpImage<unsigned char> &I);
114 
115  void updateParameters(const vpImage<unsigned char> &I, double rho, double theta);
116  void updateParameters(const vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, double rho,
117  double theta);
118 
119 private:
120  void bubbleSortI();
121  void bubbleSortJ();
122  virtual void sample(const vpImage<unsigned char> &image, bool doNotTrack = false);
123  void seekExtremities(const vpImage<unsigned char> &I);
124  void setExtremities();
125  void suppressPoints(const vpImage<unsigned char> &I);
126  void reSample(const vpImage<unsigned char> &image);
127  void reSample(const vpImage<unsigned char> &image, const vpImagePoint &ip1, const vpImagePoint &ip2);
128  void updateDelta();
129 };
130 
131 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
132 
133 #endif
Class to define RGB colors available for display functionnalities.
Definition: vpColor.h:158
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:89
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:154
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'....
Definition: vpMeSite.h:72
Contains abstract elements for a Distance to Feature type feature.
Definition: vpMeTracker.h:66
void initTracking(const vpImage< unsigned char > &I)
virtual void sample(const vpImage< unsigned char > &image, bool doNotTrack=false)=0
Sample pixels at a given interval.
void track(const vpImage< unsigned char > &I)
Track sampled pixels.
virtual void display(const vpImage< unsigned char > &I, vpColor col)=0