Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpMeLine.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 * Moving edges.
32 */
33
39#ifndef vpMeLine_HH
40#define vpMeLine_HH
41
42#include <visp3/core/vpMath.h>
43#include <visp3/core/vpMatrix.h>
44#include <visp3/me/vpMeTracker.h>
45
46#include <iostream>
47#include <math.h>
48
147class VISP_EXPORT vpMeLine : public vpMeTracker
148{
149private:
150 static void update_indices(double theta, int incr, int i, int j, int &i1, int &i2, int &j1, int &j2);
151
152protected:
153 vpMeSite PExt[2];
154
155 double rho;
156 double theta;
157 double delta;
158 double delta_1;
159 double angle;
160 double angle_1;
161 int sign;
162
166
167#ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
168public:
169#else
170protected:
171#endif
172
173 double a;
174 double b;
175 double c;
176
177public:
181 vpMeLine();
182
186 vpMeLine(const vpMeLine &meline);
187
191 virtual ~vpMeLine();
192
204 void display(const vpImage<unsigned char> &I, const vpColor &color, unsigned int thickness = 1);
205
211 void track(const vpImage<unsigned char> &I);
212
223#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
224 virtual void sample(const vpImage<unsigned char> &I, bool doNotTrack = false) override;
225#else
226 virtual void sample(const vpImage<unsigned char> &I, bool doNotTrack = false);
227#endif
228
239 void reSample(const vpImage<unsigned char> &I);
240
246 void leastSquare();
247
251 void updateDelta();
252
256 void setExtremities();
257
268 void seekExtremities(const vpImage<unsigned char> &I);
269
273 void suppressPoints();
274
282
291 void initTracking(const vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2);
292
298 void computeRhoTheta(const vpImage<unsigned char> &I);
299
308 double getRho() const;
309
313 double getTheta() const;
314
321 void getExtremities(vpImagePoint &ip1, vpImagePoint &ip2);
322
326 void getEquationParam(double &A, double &B, double &C)
327 {
328 A = a;
329 B = b;
330 C = c;
331 }
332
336 inline double getA() const { return a; }
337
341 inline double getB() const { return b; }
342
346 inline double getC() const { return c; }
347
359 static bool intersection(const vpMeLine &line1, const vpMeLine &line2, vpImagePoint &ip);
360
370 inline void computeRhoSignFromIntensity(bool useIntensityForRho) { _useIntensityForRho = useIntensityForRho; }
371
372 // Static Functions
373public:
387 static void displayLine(const vpImage<unsigned char> &I, const vpMeSite &PExt1, const vpMeSite &PExt2, const double &A,
388 const double &B, const double &C, const vpColor &color = vpColor::green,
389 unsigned int thickness = 1);
390
404 static void displayLine(const vpImage<vpRGBa> &I, const vpMeSite &PExt1, const vpMeSite &PExt2, const double &A,
405 const double &B, const double &C, const vpColor &color = vpColor::green,
406 unsigned int thickness = 1);
407
422 static void displayLine(const vpImage<unsigned char> &I, const vpMeSite &PExt1, const vpMeSite &PExt2,
423 const std::list<vpMeSite> &site_list, const double &A, const double &B, const double &C,
424 const vpColor &color = vpColor::green, unsigned int thickness = 1);
425
440 static void displayLine(const vpImage<vpRGBa> &I, const vpMeSite &PExt1, const vpMeSite &PExt2,
441 const std::list<vpMeSite> &site_list, const double &A, const double &B, const double &C,
442 const vpColor &color = vpColor::green, unsigned int thickness = 1);
443
444#ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
445 vp_deprecated static void display(const vpImage<unsigned char> &I, const vpMeSite &PExt1, const vpMeSite &PExt2, const double &A,
446 const double &B, const double &C, const vpColor &color = vpColor::green,
447 unsigned int thickness = 1);
448 vp_deprecated static void display(const vpImage<vpRGBa> &I, const vpMeSite &PExt1, const vpMeSite &PExt2, const double &A,
449 const double &B, const double &C, const vpColor &color = vpColor::green,
450 unsigned int thickness = 1);
451
452 vp_deprecated static void display(const vpImage<unsigned char> &I, const vpMeSite &PExt1, const vpMeSite &PExt2,
453 const std::list<vpMeSite> &site_list, const double &A, const double &B, const double &C,
454 const vpColor &color = vpColor::green, unsigned int thickness = 1);
455 vp_deprecated static void display(const vpImage<vpRGBa> &I, const vpMeSite &PExt1, const vpMeSite &PExt2,
456 const std::list<vpMeSite> &site_list, const double &A, const double &B, const double &C,
457 const vpColor &color = vpColor::green, unsigned int thickness = 1);
458#endif
459};
460
461#endif
Class to define RGB colors available for display functionalities.
Definition vpColor.h:152
static const vpColor green
Definition vpColor.h:214
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition of the vpImage class member functions.
Definition vpImage.h:135
Class that tracks in an image a line moving edges.
Definition vpMeLine.h:148
double theta
theta parameter of the line
Definition vpMeLine.h:156
double getA() const
Definition vpMeLine.h:336
double a
Parameter a of the line equation a*i + b*j + c = 0.
Definition vpMeLine.h:173
double getB() const
Definition vpMeLine.h:341
double angle
Angle in deg between the extremities.
Definition vpMeLine.h:159
double c
Parameter c of the line equation a*i + b*j + c = 0.
Definition vpMeLine.h:175
double rho
rho parameter of the line
Definition vpMeLine.h:155
int sign
Sign.
Definition vpMeLine.h:161
void computeRhoSignFromIntensity(bool useIntensityForRho)
Definition vpMeLine.h:370
void getEquationParam(double &A, double &B, double &C)
Definition vpMeLine.h:326
double angle_1
Angle in deg between the extremities.
Definition vpMeLine.h:160
double delta_1
Angle in rad between the extremities.
Definition vpMeLine.h:158
double delta
Angle in rad between the extremities.
Definition vpMeLine.h:157
double b
Parameter b of the line equation a*i + b*j + c = 0.
Definition vpMeLine.h:174
bool _useIntensityForRho
Definition vpMeLine.h:165
double getC() const
Definition vpMeLine.h:346
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)