ViSP  2.6.2
vpMeLine.h
1 /****************************************************************************
2  *
3  * $Id: vpMeLine.h 3581 2012-03-01 15:19:07Z ayol $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2012 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  *
40  *****************************************************************************/
41 
47 #ifndef vpMeLine_HH
48 #define vpMeLine_HH
49 
50 #include <visp/vpMatrix.h>
51 #include <visp/vpMath.h>
52 #include <visp/vpMeTracker.h>
53 
54 #include <math.h>
55 #include <iostream>
56 
149 class VISP_EXPORT vpMeLine : public vpMeTracker
150 {
151 private:
152  static void update_indices(double theta,int incr,int i,int j,int& i1,int& i2,int& j1,int& j2);
153 
154 protected:
155  vpMeSite PExt[2] ;
156 
157  double rho, theta ;
158  double delta ,delta_1;
159  double angle, angle_1;
160  int sign;
161 
164 
165 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
166 public:
167 #else
168 protected:
169 #endif
170 
171  double a;
172  double b;
173  double c;
174 
175 public:
176  vpMeLine() ;
177  vpMeLine(const vpMeLine &meline);
178  virtual ~vpMeLine() ;
179 
180  void display(const vpImage<unsigned char>& I, vpColor col) ;
181 
182  void track(const vpImage<unsigned char>& Im);
183 
184  void sample(const vpImage<unsigned char>&image);
185  void reSample(const vpImage<unsigned char> &I) ;
186  void leastSquare() ;
187  void updateDelta();
188  void setExtremities() ;
189  void seekExtremities(const vpImage<unsigned char> &I) ;
190  void suppressPoints() ;
191 
192  void initTracking(const vpImage<unsigned char> &I) ;
193  void initTracking(const vpImage<unsigned char> &I,
194  const vpImagePoint &ip1,
195  const vpImagePoint &ip2) ;
196 
197  void computeRhoTheta(const vpImage<unsigned char> &I) ;
198  double getRho() const ;
199  double getTheta() const ;
200  void getExtremities(vpImagePoint &ip1, vpImagePoint &ip2) ;
201 
205  void getEquationParam(double &A, double &B, double &C) { A = a; B = b; C = c; }
206 
210  inline double getA() const {return a; }
211 
215  inline double getB() const {return b; }
216 
220  inline double getC() const {return c; }
221 
222  static bool intersection(const vpMeLine &line1, const vpMeLine &line2,
223  vpImagePoint &ip);
224 
234  inline void computeRhoSignFromIntensity(const bool useIntensityForRho){
235  _useIntensityForRho = useIntensityForRho;
236  }
237 
238 //Static Functions
239 public:
240  static void display(const vpImage<unsigned char>& I,const vpMeSite &PExt1, const vpMeSite &PExt2,
241  const double &A, const double &B, const double &C,
242  vpColor color = vpColor::green, unsigned int thickness=1);
243 
244  static void display(const vpImage<unsigned char>& I,const vpMeSite &PExt1, const vpMeSite &PExt2,
245  const std::list<vpMeSite> &site_list,
246  const double &A, const double &B, const double &C,
247  vpColor color = vpColor::green, unsigned int thickness=1);
248 
249 };
250 
251 
252 
253 
254 #endif
255 
256 
void computeRhoSignFromIntensity(const bool useIntensityForRho)
Definition: vpMeLine.h:234
double c
Parameter c of the line equation a*i + b*j + c = 0.
Definition: vpMeLine.h:173
double getB() const
Definition: vpMeLine.h:215
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'...
Definition: vpMeSite.h:76
Class to define colors available for display functionnalities.
Definition: vpColor.h:123
bool _useIntensityForRho
Flag to specify wether the intensity of the image at the middle point is used to compute the sign of ...
Definition: vpMeLine.h:163
virtual void sample(const vpImage< unsigned char > &image)=0
Sample pixels at a given interval.
static const vpColor green
Definition: vpColor.h:168
double theta
Definition: vpMeLine.h:157
Class that tracks in an image a line moving edges.
Definition: vpMeLine.h:149
double delta_1
Definition: vpMeLine.h:158
double getA() const
Definition: vpMeLine.h:210
void track(const vpImage< unsigned char > &I)
Track sampled pixels.
Contains abstract elements for a Distance to Feature type feature.
Definition: vpMeTracker.h:71
double a
Parameter a of the line equation a*i + b*j + c = 0.
Definition: vpMeLine.h:171
double b
Parameter b of the line equation a*i + b*j + c = 0.
Definition: vpMeLine.h:172
int sign
Definition: vpMeLine.h:160
void initTracking(const vpImage< unsigned char > &I)
double angle_1
Definition: vpMeLine.h:159
void getEquationParam(double &A, double &B, double &C)
Definition: vpMeLine.h:205
double getC() const
Definition: vpMeLine.h:220
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:92
virtual void display(const vpImage< unsigned char > &I, vpColor col)=0