Skip to content

Commit

Permalink
Revert "pt: change point internal representation"
Browse files Browse the repository at this point in the history
This reverts commit e89c2b1.

Issue: #199
  • Loading branch information
sthalik committed Jul 24, 2015
1 parent b0f6b7d commit d148587
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions ftnoir_tracker_pt/ftnoir_tracker_pt.cpp
Expand Up @@ -59,7 +59,7 @@ float Tracker_PT::get_focal_length()
static constexpr double pi = 3.1415926f;
const double diag = sqrt(w * w + h * h)/w, diag_fov = static_cast<int>(s.fov) * pi / 180.;
const double fov = 2.*atan(tan(diag_fov/2.0)/sqrt(1. + diag*diag));
return w*.5 / tan(.5 * fov);
return .5 / tan(.5 * fov);
}

void Tracker_PT::run()
Expand Down Expand Up @@ -112,17 +112,18 @@ void Tracker_PT::run()
for (unsigned i = 0; i < points.size(); i++)
{
auto& p = points[i];
auto p2 = cv::Point(p[0] * frame.cols + frame.cols/2, -p[1] * frame.cols + frame.rows/2);
cv::Scalar color(0, 255, 0);
if (i == points.size()-1)
color = cv::Scalar(0, 0, 255);
cv::line(frame,
cv::Point(p[0] - 20, p[1]),
cv::Point(p[0] + 20, p[1]),
cv::Point(p2.x - 20, p2.y),
cv::Point(p2.x + 20, p2.y),
color,
4);
cv::line(frame,
cv::Point(p[0], p[1] - 20),
cv::Point(p[0], p[1] + 20),
cv::Point(p2.x, p2.y - 20),
cv::Point(p2.x, p2.y + 20),
color,
4);
}
Expand Down
3 changes: 2 additions & 1 deletion ftnoir_tracker_pt/point_extractor.cpp
Expand Up @@ -211,7 +211,8 @@ std::vector<Vec2f> PointExtractor::extract_points(Mat& frame)
for (auto& b : simple_blob::merge(blobs))
{
auto pos = b.effective_pos();
points.push_back(pos);
Vec2f p((pos[0] - W/2)/W, -(pos[1] - H/2)/W);
points.push_back(p);
}

vector<Mat> channels_;
Expand Down

0 comments on commit d148587

Please sign in to comment.