diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2021-09-27 12:27:22 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2021-09-27 12:28:20 +0200 |
commit | 4596d0bf8d8659411ea9dbc380336ad01c366f7b (patch) | |
tree | 3e9c5527678dce72c2145a59d46113d3d089e5ad /cv | |
parent | deff5fda016a18fd1d5a8a2b6c0611245757aaff (diff) |
cv, tracker/pt: use cv::Mat::create()
Diffstat (limited to 'cv')
-rw-r--r-- | cv/video-widget.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/cv/video-widget.cpp b/cv/video-widget.cpp index 289b9cee..ea5e13ac 100644 --- a/cv/video-widget.cpp +++ b/cv/video-widget.cpp @@ -13,15 +13,8 @@ void cv_video_widget::update_image(const cv::Mat& frame) return; cv::Mat const* __restrict scaled = nullptr; - - if (frame3.cols != W || frame3.rows != H) - { - frame3 = cv::Mat(H, W, frame.type()); - frame2 = cv::Mat(H, W, CV_8UC4); - - if (!frame2.isContinuous() || !frame3.isContinuous()) - std::abort(); - } + frame3.create(H, W, frame.type()); + frame2.create(H, W, CV_8UC4); if (frame.cols != W || frame.rows != H) { @@ -37,7 +30,6 @@ void cv_video_widget::update_image(const cv::Mat& frame) scaled = &frame; int color_cvt = cv::COLOR_COLORCVT_MAX; - constexpr int nchannels = 4; switch (scaled->channels()) { @@ -47,7 +39,7 @@ void cv_video_widget::update_image(const cv::Mat& frame) case 3: color_cvt = cv::COLOR_BGR2BGRA; break; - case nchannels: + case 4: break; default: unreachable(); |