Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpMeNurbs.h
1/*
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2025 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
40
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
139class VISP_EXPORT vpMeNurbs : public vpMeTracker
140{
141#ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
142public:
143#else
144private:
145#endif
148
149private:
151 double dist;
153 unsigned int nbControlPoints;
156 int beginPtFound;
159 int endPtFound;
162 bool enableCannyDetection;
164 float cannyTh1;
166 float cannyTh2;
167
168public:
172 vpMeNurbs();
173
177 vpMeNurbs(const vpMeNurbs &menurbs);
178
184 void setNbControlPoints(unsigned int nb_point) { this->nbControlPoints = nb_point; }
185
192 void setEnableCannyDetection(const bool enable_canny) { this->enableCannyDetection = enable_canny; }
193
200 void setCannyThreshold(float th1, float th2)
201 {
202 this->cannyTh1 = th1;
203 this->cannyTh2 = th2;
204 }
205
213
221 void initTracking(const vpImage<unsigned char> &I, const std::list<vpImagePoint> &ptList);
222
228 void track(const vpImage<unsigned char> &I);
229
237 virtual void sample(const vpImage<unsigned char> &I, bool doNotTrack = false);
238
249 void reSample(const vpImage<unsigned char> &I);
250
255 void updateDelta();
256
264 void seekExtremities(const vpImage<unsigned char> &I);
265
277 void seekExtremitiesCanny(const vpImage<unsigned char> &I);
278
285 void suppressPoints();
286
292 void supressNearPoints();
293
301 void localReSample(const vpImage<unsigned char> &I);
302
306 inline vpNurbs getNurbs() const { return nurbs; }
307
318 void display(const vpImage<unsigned char> &I, const vpColor &color, unsigned int thickness = 1);
319
320private:
321 bool computeFreemanChainElement(const vpImage<unsigned char> &I, vpImagePoint &iP, unsigned int &element);
322
323 bool hasGoodLevel(const vpImage<unsigned char> &I, const vpImagePoint &iP) const;
324
325 bool isInImage(const vpImage<unsigned char> &I, const vpImagePoint &iP) const;
326
327 void computeFreemanParameters(unsigned int element, vpImagePoint &diP);
328
329 bool farFromImageEdge(const vpImage<unsigned char> &I, const vpImagePoint &iP);
330
331public:
340 static void display(const vpImage<unsigned char> &I, vpNurbs &n, const vpColor &color = vpColor::green, unsigned int thickness = 1);
341
350 static void display(const vpImage<vpRGBa> &I, vpNurbs &n, const vpColor &color = vpColor::green, unsigned int thickness = 1);
351};
352END_VISP_NAMESPACE
353#endif
Class to define RGB colors available for display functionalities.
Definition vpColor.h:157
static const vpColor green
Definition vpColor.h:201
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:131
void setCannyThreshold(float th1, float th2)
Definition vpMeNurbs.h:200
vpNurbs nurbs
The Nurbs which represents the tracked edge.
Definition vpMeNurbs.h:147
void setEnableCannyDetection(const bool enable_canny)
Definition vpMeNurbs.h:192
void setNbControlPoints(unsigned int nb_point)
Definition vpMeNurbs.h:184
vpNurbs getNurbs() const
Definition vpMeNurbs.h:306
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