Visual Servoing Platform  version 3.6.1 under development (2024-10-15)
vpMbtMeLine.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See https://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Implementation of a line used by the model-based tracker.
32  */
33 
39 #ifndef vpMbtMeLine_HH
40 #define vpMbtMeLine_HH
41 
42 #include <visp3/core/vpConfig.h>
43 #include <visp3/core/vpPoint.h>
44 #include <visp3/me/vpMe.h>
45 #include <visp3/me/vpMeTracker.h>
46 
47 #ifndef DOXYGEN_SHOULD_SKIP_THIS
48 
49 BEGIN_VISP_NAMESPACE
55 class VISP_EXPORT vpMbtMeLine : public vpMeTracker
56 {
57 private:
58  vpMeSite m_PExt[2];
59  double m_rho, m_theta, m_theta_1;
60  double m_delta, m_delta_1;
61  int m_sign;
62  double m_a, m_b, m_c;
63 
64 public:
65  int imin, imax;
66  int jmin, jmax;
67  double expecteddensity;
68 
69 public:
70  vpMbtMeLine();
71  virtual ~vpMbtMeLine() VP_OVERRIDE;
72 
73  void computeProjectionError(const vpImage<unsigned char> &_I, double &_sumErrorRad, unsigned int &_nbFeatures,
74  const vpMatrix &SobelX, const vpMatrix &SobelY, bool display, unsigned int length,
75  unsigned int thickness);
76 
77  void display(const vpImage<unsigned char> & /* I */, const vpColor &/* col */, unsigned int /* thickness */) { ; }
79 
86  inline double get_a() const { return m_a; }
87 
94  inline double get_b() const { return m_b; }
95 
102  inline double get_c() const { return m_c; }
103 
104  void initTracking(const vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, double rho,
105  double theta, bool doNoTrack);
106 
107  void track(const vpImage<unsigned char> &I);
108 
109  void updateParameters(const vpImage<unsigned char> &I, double rho, double theta);
110  void updateParameters(const vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, double rho,
111  double theta);
112 
113 private:
114  void bubbleSortI();
115  void bubbleSortJ();
116  void sample(const vpImage<unsigned char> &image, bool doNotTrack = false) VP_OVERRIDE;
117  void seekExtremities(const vpImage<unsigned char> &I);
118  void setExtremities();
119  void suppressPoints(const vpImage<unsigned char> &I);
120  void reSample(const vpImage<unsigned char> &image);
121  void reSample(const vpImage<unsigned char> &image, const vpImagePoint &ip1, const vpImagePoint &ip2);
122  void updateDelta();
123 };
124 END_VISP_NAMESPACE
125 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
126 
127 #endif
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:157
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:82
Definition of the vpImage class member functions.
Definition: vpImage.h:131
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:169
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'....
Definition: vpMeSite.h:68
Contains abstract elements for a Distance to Feature type feature.
Definition: vpMeTracker.h:62
void initTracking(const vpImage< unsigned char > &I)
virtual void sample(const vpImage< unsigned char > &image, bool doNotTrack=false)=0
void track(const vpImage< unsigned char > &I)
void display(const vpImage< unsigned char > &I)