Set a default value for the second argument of test_box_overlap's constructor.

Also added overlaps_any_box().
This commit is contained in:
Davis King 2013-11-23 11:49:45 -05:00
parent 5d264ae5cd
commit 11e574ff97
2 changed files with 33 additions and 4 deletions

View File

@ -19,9 +19,9 @@ namespace dlib
) : match_thresh(0.5), overlap_thresh(1.0)
{}
test_box_overlap (
explicit test_box_overlap (
double match_thresh_,
double overlap_thresh_
double overlap_thresh_ = 1.0
) : match_thresh(match_thresh_), overlap_thresh(overlap_thresh_)
{
// make sure requires clause is not broken
@ -127,6 +127,22 @@ namespace dlib
return test_box_overlap(max_match_score, max_overlap);
}
// ----------------------------------------------------------------------------------------
inline bool overlaps_any_box (
const test_box_overlap& tester,
const std::vector<rectangle>& rects,
const rectangle& rect
)
{
for (unsigned long i = 0; i < rects.size(); ++i)
{
if (tester(rects[i],rect))
return true;
}
return false;
}
// ----------------------------------------------------------------------------------------
}

View File

@ -32,9 +32,9 @@ namespace dlib
- #get_overlap_thresh() == 1.0
!*/
test_box_overlap (
explicit test_box_overlap (
double match_thresh,
double overlap_thresh
double overlap_thresh = 1.0
);
/*!
requires
@ -117,6 +117,19 @@ namespace dlib
- TBO(A,B) == false
!*/
// ----------------------------------------------------------------------------------------
bool overlaps_any_box (
const test_box_overlap& tester,
const std::vector<rectangle>& rects,
const rectangle& rect
);
/*!
ensures
- returns true if rect overlaps any box in rects and false otherwise. Overlap
is determined based on the given tester object.
!*/
// ----------------------------------------------------------------------------------------
}