Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpMeNurbs.h
1/*
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2023 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 https://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
41#ifndef vpMeNurbs_HH
42#define vpMeNurbs_HH
43
44#include <visp3/core/vpMath.h>
45#include <visp3/core/vpMatrix.h>
46#include <visp3/me/vpMeTracker.h>
47#include <visp3/me/vpNurbs.h>
48
49#include <iostream>
50#include <list>
51#include <math.h>
52
128class VISP_EXPORT vpMeNurbs : public vpMeTracker
129{
130#ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
131public:
132#else
133private:
134#endif
137
138private:
140 double dist;
142 unsigned int nbControlPoints;
145 int beginPtFound;
148 int endPtFound;
151 bool enableCannyDetection;
153 float cannyTh1;
155 float cannyTh2;
156
157public:
161 vpMeNurbs();
162
166 vpMeNurbs(const vpMeNurbs &menurbs);
167
171 virtual ~vpMeNurbs();
172
178 void setNbControlPoints(unsigned int nb_point) { this->nbControlPoints = nb_point; }
179
186 void setEnableCannyDetection(const bool enable_canny) { this->enableCannyDetection = enable_canny; }
187
194 void setCannyThreshold(float th1, float th2)
195 {
196 this->cannyTh1 = th1;
197 this->cannyTh2 = th2;
198 }
199
207
215 void initTracking(const vpImage<unsigned char> &I, const std::list<vpImagePoint> &ptList);
216
222 void track(const vpImage<unsigned char> &I);
223
231 virtual void sample(const vpImage<unsigned char> &I, bool doNotTrack = false);
232
243 void reSample(const vpImage<unsigned char> &I);
244
249 void updateDelta();
250
257
265 void seekExtremities(const vpImage<unsigned char> &I);
266
278 void seekExtremitiesCanny(const vpImage<unsigned char> &I);
279
286 void suppressPoints();
287
293 void supressNearPoints();
294
302 void localReSample(const vpImage<unsigned char> &I);
303
307 inline vpNurbs getNurbs() const { return nurbs; }
308
319 void display(const vpImage<unsigned char> &I, const vpColor &color, unsigned int thickness = 1);
320
321private:
322 bool computeFreemanChainElement(const vpImage<unsigned char> &I, vpImagePoint &iP, unsigned int &element);
323
324 bool hasGoodLevel(const vpImage<unsigned char> &I, const vpImagePoint &iP) const;
325
326 bool isInImage(const vpImage<unsigned char> &I, const vpImagePoint &iP) const;
327
328 void computeFreemanParameters(unsigned int element, vpImagePoint &diP);
329
330 bool farFromImageEdge(const vpImage<unsigned char> &I, const vpImagePoint &iP);
331
332public:
341 static void display(const vpImage<unsigned char> &I, vpNurbs &n, const vpColor &color = vpColor::green, unsigned int thickness = 1);
342
351 static void display(const vpImage<vpRGBa> &I, vpNurbs &n, const vpColor &color = vpColor::green, unsigned int thickness = 1);
352};
353
354#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 edge defined by a Nurbs.
Definition vpMeNurbs.h:129
void setCannyThreshold(float th1, float th2)
Definition vpMeNurbs.h:194
vpNurbs nurbs
The Nurbs which represents the tracked edge.
Definition vpMeNurbs.h:136
void setEnableCannyDetection(const bool enable_canny)
Definition vpMeNurbs.h:186
void setNbControlPoints(unsigned int nb_point)
Definition vpMeNurbs.h:178
vpNurbs getNurbs() const
Definition vpMeNurbs.h:307
void setExtremities()
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)
Class that provides tools to compute and manipulate a Non Uniform Rational B-Spline curve.
Definition vpNurbs.h:93