From d37bed91649d2acdd9a548cd52730a87d0a28d6d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 16 Dec 2016 11:54:59 +0100 Subject: tracker/aruco: use simple, idiomatic way to clamp the ROI --- tracker-aruco/ftnoir_tracker_aruco.cpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp index 02b1f830..f89b1e7d 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.cpp +++ b/tracker-aruco/ftnoir_tracker_aruco.cpp @@ -214,25 +214,7 @@ void aruco_tracker::draw_ar(bool ok) void aruco_tracker::clamp_last_roi() { - if (last_roi.x < 0) - last_roi.x = 0; - if (last_roi.y < 0) - last_roi.y = 0; - if (last_roi.width < 1) - last_roi.width = 1; - if (last_roi.height < 1) - last_roi.height = 1; - if (last_roi.x >= color.cols-1) - last_roi.x = color.cols-1; - if (last_roi.width >= color.cols-1) - last_roi.width = color.cols-1; - if (last_roi.y >= color.rows-1) - last_roi.y = color.rows-1; - if (last_roi.height >= color.rows-1) - last_roi.height = color.rows-1; - - last_roi.width -= last_roi.x; - last_roi.height -= last_roi.y; + last_roi &= cv::Rect(0, 0, color.cols, color.rows); } void aruco_tracker::set_points() -- cgit v1.2.3