Visual Servoing Platform  version 3.5.1 under development (2023-05-31)
vpMeTracker.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  *****************************************************************************/
35 
41 #ifndef vpMeTracker_HH
42 #define vpMeTracker_HH
43 
44 #include <visp3/core/vpColVector.h>
45 #include <visp3/core/vpTracker.h>
46 #include <visp3/me/vpMe.h>
47 #include <visp3/me/vpMeSite.h>
48 
49 #include <iostream>
50 #include <list>
51 #include <math.h>
52 
61 class VISP_EXPORT vpMeTracker : public vpTracker
62 {
63 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
64 public:
67 #else
68 protected:
71 #endif
74  std::list<vpMeSite> list;
76  vpMe *me;
77  unsigned int init_range;
82 
83 protected:
88 
89 public:
90  // Constructor/Destructor
91  vpMeTracker();
92  vpMeTracker(const vpMeTracker &meTracker);
93  virtual ~vpMeTracker();
94 
97  virtual void display(const vpImage<unsigned char> &I, const vpColor &col, unsigned int thickness) = 0;
98  virtual void display(const vpImage<unsigned char> &I);
99  virtual void display(const vpImage<vpRGBa> &I);
100  void display(const vpImage<unsigned char> &I, vpColVector &w, unsigned int &index_w);
101 
102  static bool inMask(const vpImage<bool> *mask, unsigned int i, unsigned int j);
103 
109  inline unsigned int getInitRange() { return init_range; }
110 
116  inline vpMe *getMe() { return me; }
117 
123  inline std::list<vpMeSite> &getMeList() { return list; }
124  inline std::list<vpMeSite> getMeList() const { return list; }
125 
131  inline int getNbPoints() const { return nGoodElement; }
132 
133  void init();
134  void initTracking(const vpImage<unsigned char> &I);
135 
136  unsigned int numberOfSignal();
137 
139 
140  int outOfImage(int i, int j, int half, int row, int cols);
141  int outOfImage(const vpImagePoint &iP, int half, int rows, int cols);
142 
143  void reset();
144 
146  virtual void sample(const vpImage<unsigned char> &image, bool doNotTrack = false) = 0;
147 
148  void setDisplay(vpMeSite::vpMeSiteDisplayType select) { selectDisplay = select; }
149 
155  void setInitRange(const unsigned int &r) { init_range = r; }
156 
162  virtual void setMask(const vpImage<bool> &mask) { m_mask = &mask; }
163 
169  void setMe(vpMe *p_me) { this->me = p_me; }
170 
176  void setMeList(const std::list<vpMeSite> &l) { list = l; }
177 
178  unsigned int totalNumberOfSignal();
179 
181  void track(const vpImage<unsigned char> &I);
183 
184 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
185 public:
189  bool display_point; // if 1 (TRUE) displays the line that is being tracked
191 #endif
192 };
193 
194 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:172
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
vpMeSiteDisplayType
Definition: vpMeSite.h:69
Contains abstract elements for a Distance to Feature type feature.
Definition: vpMeTracker.h:62
const vpImage< bool > * m_mask
Mask used to disable tracking on a part of image.
Definition: vpMeTracker.h:80
int nGoodElement
Definition: vpMeTracker.h:78
std::list< vpMeSite > getMeList() const
Definition: vpMeTracker.h:124
vpMeSite::vpMeSiteDisplayType selectDisplay
Definition: vpMeTracker.h:86
vpMe * getMe()
Definition: vpMeTracker.h:116
int getNbPoints() const
Definition: vpMeTracker.h:131
virtual void sample(const vpImage< unsigned char > &image, bool doNotTrack=false)=0
Sample pixels at a given interval.
std::list< vpMeSite > list
Definition: vpMeTracker.h:74
void setDisplay(vpMeSite::vpMeSiteDisplayType select)
Definition: vpMeTracker.h:148
void setMeList(const std::list< vpMeSite > &l)
Definition: vpMeTracker.h:176
unsigned int init_range
Definition: vpMeTracker.h:77
unsigned int getInitRange()
Definition: vpMeTracker.h:109
void setInitRange(const unsigned int &r)
Definition: vpMeTracker.h:155
bool display_point
Definition: vpMeTracker.h:189
virtual void display(const vpImage< unsigned char > &I, const vpColor &col, unsigned int thickness)=0
void setMe(vpMe *p_me)
Definition: vpMeTracker.h:169
std::list< vpMeSite > & getMeList()
Definition: vpMeTracker.h:123
virtual void setMask(const vpImage< bool > &mask)
Definition: vpMeTracker.h:162
vpMe * me
Moving edges initialisation parameters.
Definition: vpMeTracker.h:76
Definition: vpMe.h:119
Class that defines what is a feature generic tracker.
Definition: vpTracker.h:65
vpTracker & operator=(const vpTracker &tracker)
Copy operator.
Definition: vpTracker.cpp:53
void init()
Default initialization.
Definition: vpTracker.cpp:47