summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/point_extractor.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-07-16 23:32:48 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-07-16 23:32:59 +0200
commit16bb3e13dd2a7ed8fa3652e313d592dd81c73a07 (patch)
tree8bd2f3f275948cf9e19a92a6b9eabe65efbd0b96 /tracker-pt/point_extractor.cpp
parent8fb85f858e85e5d0b2a217d9d31c68206266f987 (diff)
tracker/pt: declare floating-point type size in one place
We want double precision for POSIT. It's best for the type to be set in ope place without the need to go over everything while switching it back and forth during tests. Machine epsilon for float is very small as per <https://en.wikipedia.org/wiki/Machine_epsilon>. Also see the absurdly high epsilon of 1e-4 of POSIT that we've had. With floats, making the epsilon lower resulted in change deltas flushing to zero. This typically led to the translation Z value being very unstable in PT. After the epsilon and data type size changes the Z value is stable.
Diffstat (limited to 'tracker-pt/point_extractor.cpp')
-rw-r--r--tracker-pt/point_extractor.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp
index fb547ef6..f52ab424 100644
--- a/tracker-pt/point_extractor.cpp
+++ b/tracker-pt/point_extractor.cpp
@@ -21,7 +21,9 @@ PointExtractor::PointExtractor()
points.reserve(max_blobs);
}
-const std::vector<cv::Vec2f>& PointExtractor::extract_points(cv::Mat& frame)
+using vec2 = pt_types::vec2;
+
+const std::vector<vec2>& PointExtractor::extract_points(cv::Mat& frame)
{
const int W = frame.cols;
const int H = frame.rows;
@@ -53,8 +55,8 @@ const std::vector<cv::Vec2f>& PointExtractor::extract_points(cv::Mat& frame)
std::vector<int> { 0 },
cv::Mat(),
hist,
- std::vector<int> { 256/hist_c },
- std::vector<float> { 0, 256/hist_c },
+ std::vector<int> { 256 },
+ std::vector<float> { 0, 256 },
false);
const int sz = hist.cols * hist.rows;
int val = 0;
@@ -145,7 +147,7 @@ const std::vector<cv::Vec2f>& PointExtractor::extract_points(cv::Mat& frame)
for (auto& b : blobs)
{
- cv::Vec2f p((b.pos[0] - W/2)/W, -(b.pos[1] - H/2)/W);
+ vec2 p((b.pos[0] - W/2)/W, -(b.pos[1] - H/2)/W);
points.push_back(p);
}
return points;