summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-12-16 11:54:59 +0100
committerStanislaw Halik <sthalik@misaki.pl>2016-12-16 11:54:59 +0100
commitd37bed91649d2acdd9a548cd52730a87d0a28d6d (patch)
tree1d225da682713e333e35869b923df9ac24b1632e
parent399cbfcbe062a3daf39666ae98c6fdb8c6376494 (diff)
tracker/aruco: use simple, idiomatic way to clamp the ROI
-rw-r--r--tracker-aruco/ftnoir_tracker_aruco.cpp20
1 files changed, 1 insertions, 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()