summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/module/frame.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-09-27 12:27:22 +0200
committerStanislaw Halik <sthalik@misaki.pl>2021-09-27 12:28:20 +0200
commit4596d0bf8d8659411ea9dbc380336ad01c366f7b (patch)
tree3e9c5527678dce72c2145a59d46113d3d089e5ad /tracker-pt/module/frame.cpp
parentdeff5fda016a18fd1d5a8a2b6c0611245757aaff (diff)
cv, tracker/pt: use cv::Mat::create()
Diffstat (limited to 'tracker-pt/module/frame.cpp')
-rw-r--r--tracker-pt/module/frame.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/tracker-pt/module/frame.cpp b/tracker-pt/module/frame.cpp
index b1690aa1..09d469f2 100644
--- a/tracker-pt/module/frame.cpp
+++ b/tracker-pt/module/frame.cpp
@@ -36,15 +36,14 @@ void Preview::set_last_frame(const pt_frame& frame_)
Preview::Preview(int w, int h)
{
- ensure_size(frame_out, w, h, CV_8UC4);
- ensure_size(frame_copy, w, h, CV_8UC3);
-
- frame_copy.setTo(cv::Scalar(0, 0, 0));
+ frame_out.create(w, h, CV_8UC4);
+ frame_copy.create(w, h, CV_8UC3);
+ frame_copy.setTo({0});
}
QImage Preview::get_bitmap()
{
- int stride = frame_out.step.p[0];
+ int stride = (int)frame_out.step.p[0];
if (stride < 64 || stride < frame_out.cols * 4)
{
@@ -80,10 +79,4 @@ void Preview::draw_head_center(f x, f y)
color, 1);
}
-void Preview::ensure_size(cv::Mat& frame, int w, int h, int type)
-{
- if (frame.cols != w || frame.rows != h || frame.type() != type)
- frame = cv::Mat(h, w, type);
-}
-
} // ns pt_module