diff options
Diffstat (limited to 'cv/video-widget.cpp')
-rw-r--r-- | cv/video-widget.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/cv/video-widget.cpp b/cv/video-widget.cpp index 289b9cee..7accd275 100644 --- a/cv/video-widget.cpp +++ b/cv/video-widget.cpp @@ -1,5 +1,5 @@ #include "video-widget.hpp" - +#include "compat/macros.h" #include <opencv2/imgproc.hpp> void cv_video_widget::update_image(const cv::Mat& frame) @@ -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(); |