diff options
Diffstat (limited to 'tracker-easy/frame.cpp')
-rw-r--r-- | tracker-easy/frame.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tracker-easy/frame.cpp b/tracker-easy/frame.cpp index 2464f85f..90d4c6f9 100644 --- a/tracker-easy/frame.cpp +++ b/tracker-easy/frame.cpp @@ -29,11 +29,11 @@ Preview& Preview::operator=(const cv::Mat& aFrame) const bool need_resize = iFrameRgb.cols != frame_out.cols || iFrameRgb.rows != frame_out.rows; if (need_resize) { - cv::resize(iFrameRgb, frame_copy, cv::Size(frame_out.cols, frame_out.rows), 0, 0, cv::INTER_NEAREST); + cv::resize(iFrameRgb, iFrameResized, cv::Size(frame_out.cols, frame_out.rows), 0, 0, cv::INTER_NEAREST); } else { - iFrameRgb.copyTo(frame_copy); + iFrameRgb.copyTo(iFrameResized); } return *this; @@ -42,9 +42,9 @@ Preview& Preview::operator=(const cv::Mat& aFrame) Preview::Preview(int w, int h) { ensure_size(frame_out, w, h, CV_8UC4); - ensure_size(frame_copy, w, h, CV_8UC3); + ensure_size(iFrameResized, w, h, CV_8UC3); - frame_copy.setTo(cv::Scalar(0, 0, 0)); + iFrameResized.setTo(cv::Scalar(0, 0, 0)); } QImage Preview::get_bitmap() @@ -54,11 +54,11 @@ QImage Preview::get_bitmap() if (stride < 64 || stride < frame_out.cols * 4) { eval_once(qDebug() << "bad stride" << stride - << "for bitmap size" << frame_copy.cols << frame_copy.rows); + << "for bitmap size" << iFrameResized.cols << iFrameResized.rows); return QImage(); } - cv::cvtColor(frame_copy, frame_out, cv::COLOR_BGR2BGRA); + cv::cvtColor(iFrameResized, frame_out, cv::COLOR_BGR2BGRA); return QImage((const unsigned char*) frame_out.data, frame_out.cols, frame_out.rows, @@ -68,18 +68,18 @@ QImage Preview::get_bitmap() void Preview::draw_head_center(Coordinates::f x, Coordinates::f y) { - auto [px_, py_] = Coordinates::to_pixel_pos(x, y, frame_copy.cols, frame_copy.rows); + auto [px_, py_] = Coordinates::to_pixel_pos(x, y, iFrameResized.cols, iFrameResized.rows); int px = iround(px_), py = iround(py_); constexpr int len = 9; static const cv::Scalar color(0, 255, 255); - cv::line(frame_copy, + cv::line(iFrameResized, cv::Point(px - len, py), cv::Point(px + len, py), color, 1); - cv::line(frame_copy, + cv::line(iFrameResized, cv::Point(px, py - len), cv::Point(px, py + len), color, 1); |