ViSP  2.9.0
vpMeSite.h
1 /****************************************************************************
2  *
3  * $Id: vpMeSite.h 4574 2014-01-09 08:48:51Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Moving edges.
36  *
37  * Authors:
38  * Eric Marchand
39  * Andrew Comport
40  * Aurelien Yol
41  *
42  *****************************************************************************/
43 
51 #ifndef vpMeSite_H
52 #define vpMeSite_H
53 
54 #include <visp/vpMatrix.h>
55 #include <visp/vpImage.h>
56 #include <visp/vpDisplay.h>
57 #include <visp/vpMe.h>
58 
76 class VISP_EXPORT vpMeSite
77 {
78 public:
79  typedef enum
80  {
84  RANGE_RESULT
85  } vpMeSiteDisplayType;
86 
87  typedef enum
88  {
89  NO_SUPPRESSION = 0,
90  CONSTRAST = 1,
91  THRESHOLD = 2,
92  M_ESTIMATOR = 3,
93  TOO_NEAR = 4,
94  UNKNOW = 5
95  } vpMeSiteState;
96 
97 public:
98  int i,j ;
99  int i_1, j_1 ;
100  double ifloat, jfloat ;
101  unsigned char v ;
102  int mask_sign ;
103  // Angle of tangent at site
104  double alpha;
105  // Convolution of Site in previous image
106  double convlt ;
107  // Convolution of Site in previous image
108  double normGradient ;
109  // Uncertainty of point given as a probability between 0 and 1
110  double weight;
111 
112 private:
113  vpMeSiteDisplayType selectDisplay ;
114  vpMeSiteState state;
115 
116 public:
117  void init() ;
118  void init(double ip, double jp, double alphap) ;
119  void init(double ip, double jp, double alphap, double convltp) ;
120  void init(double ip, double jp, double alphap, double convltp, int sign) ;
121 
122  vpMeSite () ;
123  vpMeSite(double ip, double jp) ;
124  vpMeSite (const vpMeSite &mesite) ;
125  virtual ~vpMeSite() {} ;
126 
127  void display(const vpImage<unsigned char>& I);
128 
129  double convolution(const vpImage<unsigned char>& ima, const vpMe *me) ;
130 
131  vpMeSite *getQueryList(const vpImage<unsigned char> &I, const int range) ;
132 
133  void track(const vpImage<unsigned char>& im,
134  const vpMe *me,
135  const bool test_contraste=true);
136 
142  void setAlpha(const double &a) { alpha = a; }
143 
149  inline double getAlpha() const { return alpha; }
150 
151 
152  void setDisplay(vpMeSiteDisplayType select) { selectDisplay = select ; }
153 
159  inline int get_i() const { return i; }
160 
166  inline int get_j() const { return j; }
167 
173  inline double get_ifloat() const { return ifloat; }
174 
180  inline double get_jfloat() const { return jfloat; }
181 
189  void setState(const vpMeSiteState &flag){
190  state = flag;
191 
192  #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
193  suppress = (int)flag;
194  #endif
195  }
196 
202  inline vpMeSiteState getState() const { return state; }
203 
209  void setWeight(const double &w) { weight = w; }
210 
216  inline double getWeight() const { return weight; }
217 
218 //OpĂ©rators
219  vpMeSite &operator=(const vpMeSite &m) ;
220  int operator!=(const vpMeSite &m) ;
221 
222  friend VISP_EXPORT std::ostream& operator<<(std::ostream& os, vpMeSite& vpMeS);
223 
224 //Static functions
233  static double distance (const vpMeSite S1, const vpMeSite S2) {
234  return(sqrt(vpMath::sqr(S1.ifloat-S2.ifloat)+vpMath::sqr(S1.jfloat-S2.jfloat)));}
235 
244  static double sqrDistance (const vpMeSite S1, const vpMeSite S2) {
245  return(vpMath::sqr(S1.ifloat-S2.ifloat)+vpMath::sqr(S1.jfloat-S2.jfloat));}
246 
247  static void display(const vpImage<unsigned char>& I, const double &i, const double &j,
248  const vpMeSiteState &state = NO_SUPPRESSION);
249  static void display(const vpImage<vpRGBa>& I, const double &i, const double &j,
250  const vpMeSiteState &state = NO_SUPPRESSION);
251 
252 //Deprecated
253 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
254 public:
257  int suppress;
258 
259  vp_deprecated void getSign(const vpImage<unsigned char> &I, const int range) ;
260 #endif
261 } ;
262 
263 #endif
double getAlpha() const
Definition: vpMeSite.h:149
int get_j() const
Definition: vpMeSite.h:166
static double distance(const vpMeSite S1, const vpMeSite S2)
Definition: vpMeSite.h:233
double get_jfloat() const
Definition: vpMeSite.h:180
double jfloat
Definition: vpMeSite.h:100
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'...
Definition: vpMeSite.h:76
double alpha
Definition: vpMeSite.h:104
Contains predetermined masks for sites and holds moving edges tracking parameters.
Definition: vpMe.h:70
int mask_sign
Definition: vpMeSite.h:102
double normGradient
Definition: vpMeSite.h:108
virtual ~vpMeSite()
Definition: vpMeSite.h:125
vpMeSiteDisplayType
Definition: vpMeSite.h:79
vpMeSiteState getState() const
Definition: vpMeSite.h:202
double ifloat
Definition: vpMeSite.h:100
int suppress
Definition: vpMeSite.h:257
int get_i() const
Definition: vpMeSite.h:159
static double sqr(double x)
Definition: vpMath.h:106
void setDisplay(vpMeSiteDisplayType select)
Definition: vpMeSite.h:152
double convlt
Definition: vpMeSite.h:106
static double sqrDistance(const vpMeSite S1, const vpMeSite S2)
Definition: vpMeSite.h:244
unsigned char v
Definition: vpMeSite.h:101
void setState(const vpMeSiteState &flag)
Definition: vpMeSite.h:189
double getWeight() const
Definition: vpMeSite.h:216
int j_1
Definition: vpMeSite.h:99
void setAlpha(const double &a)
Definition: vpMeSite.h:142
int j
Definition: vpMeSite.h:98
double weight
Definition: vpMeSite.h:110
double get_ifloat() const
Definition: vpMeSite.h:173
void setWeight(const double &w)
Definition: vpMeSite.h:209
vpMeSiteState
Definition: vpMeSite.h:87