diff options
author | Stéphane Lenclud <github@lenclud.com> | 2019-04-13 12:24:17 +0200 |
---|---|---|
committer | Stéphane Lenclud <github@lenclud.com> | 2019-04-24 18:46:12 +0200 |
commit | 4af0298b4844727e87964697357af088b63921d1 (patch) | |
tree | 03c49473e6a8e65ee3e8ac9cc4b79766444bf412 /tracker-easy/frame.cpp | |
parent | 547f3314f2a4e75a5d2c540a5f1221e9c59277ae (diff) |
Easy Tracker: Deleting legacy point extractor. Various clean-up. Head center preview now working.
Diffstat (limited to 'tracker-easy/frame.cpp')
-rw-r--r-- | tracker-easy/frame.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tracker-easy/frame.cpp b/tracker-easy/frame.cpp index 90d4c6f9..12f70662 100644 --- a/tracker-easy/frame.cpp +++ b/tracker-easy/frame.cpp @@ -26,15 +26,6 @@ Preview& Preview::operator=(const cv::Mat& aFrame) return *this; } - const bool need_resize = iFrameRgb.cols != frame_out.cols || iFrameRgb.rows != frame_out.rows; - if (need_resize) - { - cv::resize(iFrameRgb, iFrameResized, cv::Size(frame_out.cols, frame_out.rows), 0, 0, cv::INTER_NEAREST); - } - else - { - iFrameRgb.copyTo(iFrameResized); - } return *this; } @@ -58,6 +49,17 @@ QImage Preview::get_bitmap() return QImage(); } + // Resize if needed + const bool need_resize = iFrameRgb.cols != frame_out.cols || iFrameRgb.rows != frame_out.rows; + if (need_resize) + { + cv::resize(iFrameRgb, iFrameResized, cv::Size(frame_out.cols, frame_out.rows), 0, 0, cv::INTER_NEAREST); + } + else + { + iFrameRgb.copyTo(iFrameResized); + } + cv::cvtColor(iFrameResized, frame_out, cv::COLOR_BGR2BGRA); return QImage((const unsigned char*) frame_out.data, @@ -66,20 +68,18 @@ QImage Preview::get_bitmap() QImage::Format_ARGB32); } -void Preview::draw_head_center(Coordinates::f x, Coordinates::f y) +void Preview::draw_head_center(numeric_types::f x, numeric_types::f y) { - auto [px_, py_] = Coordinates::to_pixel_pos(x, y, iFrameResized.cols, iFrameResized.rows); - - int px = iround(px_), py = iround(py_); + int px = iround(x), py = iround(y); constexpr int len = 9; static const cv::Scalar color(0, 255, 255); - cv::line(iFrameResized, + cv::line(iFrameRgb, cv::Point(px - len, py), cv::Point(px + len, py), color, 1); - cv::line(iFrameResized, + cv::line(iFrameRgb, cv::Point(px, py - len), cv::Point(px, py + len), color, 1); |