Blender
V4.3
intern
libmv
libmv
tracking
retrack_region_tracker.cc
Go to the documentation of this file.
1
// Copyright (c) 2011 libmv authors.
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a copy
4
// of this software and associated documentation files (the "Software"), to
5
// deal in the Software without restriction, including without limitation the
6
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
// sell copies of the Software, and to permit persons to whom the Software is
8
// furnished to do so, subject to the following conditions:
9
//
10
// The above copyright notice and this permission notice shall be included in
11
// all copies or substantial portions of the Software.
12
//
13
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
// IN THE SOFTWARE.
20
21
#include "
libmv/tracking/retrack_region_tracker.h
"
22
23
#include <cmath>
24
#include <vector>
25
26
namespace
libmv
{
27
28
bool
RetrackRegionTracker::Track
(
const
FloatImage
& image1,
29
const
FloatImage
& image2,
30
double
x1,
31
double
y1,
32
double
* x2,
33
double
* y2)
const
{
34
// Track forward, getting x2 and y2.
35
if
(!tracker_->Track(image1, image2, x1, y1, x2, y2)) {
36
return
false
;
37
}
38
// Now track x2 and y2 backward, to get xx1 and yy1 which, if the track is
39
// good, should match x1 and y1 (but may not if the track is bad).
40
double
xx1 = *x2, yy1 = *y2;
41
if
(!tracker_->Track(image2, image1, *x2, *y2, &xx1, &yy1)) {
42
return
false
;
43
}
44
double
dx = xx1 - x1;
45
double
dy = yy1 - y1;
46
return
sqrt
(dx * dx + dy * dy) < tolerance_;
47
}
48
49
}
// namespace libmv
sqrt
sqrt(x)+1/max(0
libmv::Array3D
3D array (row, column, channel).
Definition
array_nd.h:332
libmv::RetrackRegionTracker::Track
virtual bool Track(const FloatImage &image1, const FloatImage &image2, double x1, double y1, double *x2, double *y2) const
Definition
retrack_region_tracker.cc:28
libmv
Definition
libmv/autotrack/autotrack.h:30
retrack_region_tracker.h
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0