diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-02 00:47:42 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-02 00:47:42 +0100 |
commit | bfd3299b376ad3c95680a919a7146de7eaac4d51 (patch) | |
tree | e552cde9cf93e2416134a5f282e6563d196f86e8 /cv/video-widget.hpp | |
parent | dca51aa0664739dc39b7b500b7cacee8ff944ea9 (diff) |
cv/video-widget: support other color depths
Issue: #861
Diffstat (limited to 'cv/video-widget.hpp')
-rw-r--r-- | cv/video-widget.hpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cv/video-widget.hpp b/cv/video-widget.hpp index 104fa21e..b60ad7ed 100644 --- a/cv/video-widget.hpp +++ b/cv/video-widget.hpp @@ -8,6 +8,8 @@ #pragma once +#include "compat/math.hpp" + #include <memory> #include <vector> @@ -32,6 +34,7 @@ public: void update_image(const cv::Mat& frame); void update_image(const QImage& image); void get_preview_size(int& w, int& h); + void resizeEvent(QResizeEvent*) override; private slots: void paintEvent(QPaintEvent*) override; void update_and_repaint(); @@ -40,7 +43,9 @@ private: QImage texture; std::vector<unsigned char> vec; QTimer timer; - cv::Mat frame1, frame2, frame3; - int width = 320, height = 240; + cv::Mat frame2, frame3; bool freshp = false; + + int width = iround(QWidget::width() * devicePixelRatioF()); + int height = iround(QWidget::height() * devicePixelRatioF()); }; |