summaryrefslogtreecommitdiffhomepage
path: root/tracker-wii/wii_frame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-wii/wii_frame.cpp')
-rw-r--r--tracker-wii/wii_frame.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/tracker-wii/wii_frame.cpp b/tracker-wii/wii_frame.cpp
index 9332a704..fcde5235 100644
--- a/tracker-wii/wii_frame.cpp
+++ b/tracker-wii/wii_frame.cpp
@@ -17,34 +17,29 @@
using namespace pt_module;
-WIIPreview& WIIPreview::operator=(const pt_frame& frame_)
+void WIIPreview::set_last_frame(const pt_frame& frame_)
{
const struct wii_info& wii = frame_.as_const<WIIFrame>()->wii;
const cv::Mat& frame = frame_.as_const<const WIIFrame>()->mat;
- ensure_size(frame_copy, frame_out.cols, frame_out.rows, CV_8UC3);
status = wii.status;
if (frame.channels() != 3)
- {
- once_only(qDebug() << "tracker/pt: camera frame depth: 3 !=" << frame.channels());
- return *this;
- }
+ eval_once(qDebug() << "tracker/pt: camera frame depth: 3 !=" << frame.channels());
const bool need_resize = frame.cols != frame_out.cols || frame.rows != frame_out.rows;
if (need_resize)
cv::resize(frame, frame_copy, cv::Size(frame_out.cols, frame_out.rows), 0, 0, cv::INTER_NEAREST);
else
frame.copyTo(frame_copy);
-
- return *this;
}
WIIPreview::WIIPreview(int w, int h)
{
ensure_size(frame_out, w, h, CV_8UC4);
+ ensure_size(frame_copy, w, h, CV_8UC3);
- frame_out.setTo(cv::Scalar(0, 0, 0, 0));
+ frame_copy.setTo(cv::Scalar(0, 0, 0));
}
QImage WIIPreview::get_bitmap()
@@ -61,7 +56,7 @@ QImage WIIPreview::get_bitmap()
if (stride < 64 || stride < frame_out.cols * 4)
{
- once_only(qDebug() << "bad stride" << stride
+ eval_once(qDebug() << "bad stride" << stride
<< "for bitmap size" << frame_copy.cols << frame_copy.rows);
return QImage();
}
@@ -74,7 +69,7 @@ QImage WIIPreview::get_bitmap()
QImage::Format_ARGB32);
}
-void WIIPreview::draw_head_center(double x, double y)
+void WIIPreview::draw_head_center(f x, f y)
{
double px_, py_;
@@ -97,6 +92,6 @@ void WIIPreview::draw_head_center(double x, double y)
void WIIPreview::ensure_size(cv::Mat& frame, int w, int h, int type)
{
- if (frame.cols != w || frame.rows != h)
+ if (frame.cols != w || frame.rows != h || frame.type() != type)
frame = cv::Mat(h, w, type);
}