Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
vpTemplateTrackerBSpline.cpp
1
/*
2
* ViSP, open source Visual Servoing Platform software.
3
* Copyright (C) 2005 - 2025 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
* Template tracker.
32
*
33
* Authors:
34
* Amaury Dame
35
* Aurelien Yol
36
*/
37
#include <visp3/tt/vpTemplateTrackerBSpline.h>
38
39
BEGIN_VISP_NAMESPACE
40
#ifndef DOXYGEN_SHOULD_SKIP_THIS
41
42
double
vpTemplateTrackerBSpline::getSubPixBspline4(
const
vpImage<double>
&I,
double
r,
double
t)
43
{
44
double
res = 0;
45
int
cr =
static_cast<
int
>
(
r
);
46
int
ct =
static_cast<
int
>
(
t
);
47
double
er =
static_cast<
double
>
(
r
) - cr;
48
double
et =
static_cast<
double
>
(
t
) - ct;
49
int
height
=
static_cast<
int
>
(I.getHeight());
// r
50
int
width
=
static_cast<
int
>
(I.getWidth());
// t
51
for
(
int
ir = -1; ir <= 2; ir++) {
52
int
tr = ir + cr;
53
if
(tr >= 0 && tr < height) {
54
for
(
int
it = -1; it <= 2; it++) {
55
int
tt = it + ct;
56
if
(tt >= 0 && tt < width)
57
res += Bspline4(
static_cast<
double
>
(ir) - er) * Bspline4(
static_cast<
double
>
(it) - et) * I[tr][tt];
58
}
59
}
60
}
61
return
res;
62
}
63
64
double
vpTemplateTrackerBSpline::Bspline4(
double
diff)
65
{
66
double
aDiff =
vpMath::abs
(diff);
67
if
(aDiff < 1.) {
68
return
(aDiff * aDiff * (aDiff / 2. - 1) + 4. / 6.);
69
}
70
else
if
(aDiff < 2.) {
71
double
a = 2. - aDiff;
72
return
(a * a * a / 6.);
73
}
74
else
75
return
0;
76
}
77
78
#endif
79
END_VISP_NAMESPACE
vpImage
Definition of the vpImage class member functions.
Definition
vpImage.h:131
vpMath::abs
static Type abs(const Type &x)
Definition
vpMath.h:272
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
pbvs-four-points.t
t
Definition
pbvs-four-points.py:220
yolo-centering-task-afma6.r
r
Definition
yolo-centering-task-afma6.py:220
yolo-centering-task-afma6.width
width
Definition
yolo-centering-task-afma6.py:329
yolo-centering-task-afma6.height
height
Definition
yolo-centering-task-afma6.py:329
modules
tracker
tt
src
tools
vpTemplateTrackerBSpline.cpp
Generated by
1.17.0