@@ -152,22 +152,19 @@ class MarkerPainter
152152 }
153153};
154154
155- static inline vector< double > getDistanceVector (map<int , vector<Point2f> > &golds, const vector<int >& ids,
155+ static inline double getMaxDistance (map<int , vector<Point2f> > &golds, const vector<int >& ids,
156156 const vector<vector<Point2f> >& corners)
157157{
158- vector< double > distVector (ids. size (), numeric_limits< double >:: max ()) ;
158+ double distance = 0 . ;
159159 for (size_t i = 0 ; i < ids.size (); i++)
160160 {
161161 int id = ids[i];
162162 const auto gold_corners = golds.find (id);
163163 if (gold_corners != golds.end ())
164164 for (int c = 0 ; c < 4 ; c++)
165- {
166- double distance = cv::norm (gold_corners->second [c] - corners[i][c]);
167- distVector[i] = distance;
168- }
165+ distance = std::max (distance, cv::norm (gold_corners->second [c] - corners[i][c]));
169166 }
170- return distVector ;
167+ return distance ;
171168}
172169
173170PERF_TEST_P (EstimateAruco, ArucoFirst, ESTIMATE_PARAMS)
@@ -180,7 +177,7 @@ PERF_TEST_P(EstimateAruco, ArucoFirst, ESTIMATE_PARAMS)
180177 detectorParams->cornerRefinementMethod = cv::aruco::CORNER_REFINE_SUBPIX;
181178
182179 const int markerSize = 100 ;
183- const size_t numMarkersInRow = 9 ;
180+ const int numMarkersInRow = 9 ;
184181 // USE_ARUCO3
185182 detectorParams->useAruco3Detection = get<0 >(testParams);
186183 if (detectorParams->useAruco3Detection ) {
@@ -197,9 +194,10 @@ PERF_TEST_P(EstimateAruco, ArucoFirst, ESTIMATE_PARAMS)
197194 {
198195 aruco::detectMarkers (image_map.first , dictionary, corners, ids, detectorParams);
199196 }
200- ASSERT_EQ (numMarkersInRow*numMarkersInRow, ids.size ());
201- auto distVector = getDistanceVector (image_map.second , ids, corners);
202- SANITY_CHECK (distVector, 3.0 *4.0 , ERROR_ABSOLUTE);
197+ ASSERT_EQ (numMarkersInRow*numMarkersInRow, static_cast <int >(ids.size ()));
198+ double maxDistance = getMaxDistance (image_map.second , ids, corners);
199+ ASSERT_LT (maxDistance, 3 .);
200+ SANITY_CHECK_NOTHING ();
203201}
204202
205203PERF_TEST_P (EstimateAruco, ArucoSecond, ESTIMATE_PARAMS)
@@ -218,7 +216,7 @@ PERF_TEST_P(EstimateAruco, ArucoSecond, ESTIMATE_PARAMS)
218216 detectorParams->minMarkerLengthRatioOriginalImg = 0 .f ;
219217 }
220218 const int markerSize = 200 ;
221- const size_t numMarkersInRow = 11 ;
219+ const int numMarkersInRow = 11 ;
222220 MarkerPainter painter (markerSize);
223221 auto image_map = painter.getProjectMarkersTile (numMarkersInRow, detectorParams, dictionary);
224222
@@ -229,9 +227,10 @@ PERF_TEST_P(EstimateAruco, ArucoSecond, ESTIMATE_PARAMS)
229227 {
230228 aruco::detectMarkers (image_map.first , dictionary, corners, ids, detectorParams);
231229 }
232- ASSERT_EQ (numMarkersInRow*numMarkersInRow, ids.size ());
233- auto distVector = getDistanceVector (image_map.second , ids, corners);
234- SANITY_CHECK (distVector, 3.0 *4.0 , ERROR_ABSOLUTE);
230+ ASSERT_EQ (numMarkersInRow*numMarkersInRow, static_cast <int >(ids.size ()));
231+ double maxDistance = getMaxDistance (image_map.second , ids, corners);
232+ ASSERT_LT (maxDistance, 3 .);
233+ SANITY_CHECK_NOTHING ();
235234}
236235
237236struct Aruco3Params
@@ -284,8 +283,9 @@ PERF_TEST_P(EstimateLargeAruco, ArucoFHD, ESTIMATE_FHD_PARAMS)
284283 aruco::detectMarkers (image_map.first , dictionary, corners, ids, detectorParams);
285284 }
286285 ASSERT_EQ (numMarkersInRow*numMarkersInRow, static_cast <int >(ids.size ()));
287- auto distVector = getDistanceVector (image_map.second , ids, corners);
288- SANITY_CHECK (distVector, 3.0 *4.0 , ERROR_ABSOLUTE);
286+ double maxDistance = getMaxDistance (image_map.second , ids, corners);
287+ ASSERT_LT (maxDistance, 3 .);
288+ SANITY_CHECK_NOTHING ();
289289}
290290
291291}
0 commit comments