Visual Servoing Platform  version 3.6.1 under development (2024-04-19)
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/vpPoint.h>
43 #include <visp3/me/vpMe.h>
44 #include <visp3/me/vpMeTracker.h>
45 
46 #ifndef DOXYGEN_SHOULD_SKIP_THIS
47 
53 class VISP_EXPORT vpMbtMeLine : public vpMeTracker
54 {
55 private:
56  vpMeSite m_PExt[2];
57  double m_rho, m_theta, m_theta_1;
58  double m_delta, m_delta_1;
59  int m_sign;
60  double m_a, m_b, m_c;
61 
62 public:
63  int imin, imax;
64  int jmin, jmax;
65  double expecteddensity;
66 
67 public:
68  vpMbtMeLine();
69  virtual ~vpMbtMeLine() vp_override;
70 
71  void computeProjectionError(const vpImage<unsigned char> &_I, double &_sumErrorRad, unsigned int &_nbFeatures,
72  const vpMatrix &SobelX, const vpMatrix &SobelY, bool display, unsigned int length,
73  unsigned int thickness);
74 
75  void display(const vpImage<unsigned char> & /* I */, const vpColor &/* col */, unsigned int /* thickness */) { ; }
77 
84  inline double get_a() const { return m_a; }
85 
92  inline double get_b() const { return m_b; }
93 
100  inline double get_c() const { return m_c; }
101 
102  void initTracking(const vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, double rho,
103  double theta, bool doNoTrack);
104 
105  void track(const vpImage<unsigned char> &I);
106 
107  void updateParameters(const vpImage<unsigned char> &I, double rho, double theta);
108  void updateParameters(const vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2, double rho,
109  double theta);
110 
111 private:
112  void bubbleSortI();
113  void bubbleSortJ();
114  void sample(const vpImage<unsigned char> &image, bool doNotTrack = false) vp_override;
115  void seekExtremities(const vpImage<unsigned char> &I);
116  void setExtremities();
117  void suppressPoints(const vpImage<unsigned char> &I);
118  void reSample(const vpImage<unsigned char> &image);
119  void reSample(const vpImage<unsigned char> &image, const vpImagePoint &ip1, const vpImagePoint &ip2);
120  void updateDelta();
121 };
122 
123 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
124 
125 #endif
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:152
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:69
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:146
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'....
Definition: vpMeSite.h:65
Contains abstract elements for a Distance to Feature type feature.
Definition: vpMeTracker.h:60
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)