Commit 91dbcb33 authored by Davis King's avatar Davis King

filled out spec

parent cf8e0529
...@@ -12,30 +12,47 @@ namespace dlib ...@@ -12,30 +12,47 @@ namespace dlib
class test_box_overlap class test_box_overlap
{ {
/*!
WHAT THIS OBJECT REPRESENTS
This object is a simple function object for determining if two rectangles
overlap.
!*/
public: public:
test_box_overlap ( test_box_overlap (
) : overlap_thresh(0.5) );
{} /*!
ensures
- #get_overlap_thresh() == 0.5
!*/
test_box_overlap ( test_box_overlap (
double overlap_thresh_ double overlap_thresh
) : overlap_thresh(overlap_thresh_) {} );
/*!
requires
- 0 <= overlap_thresh <= 1
ensures
- #get_overlap_thresh() == overlap_thresh
!*/
bool operator() ( bool operator() (
const dlib::rectangle& a, const dlib::rectangle& a,
const dlib::rectangle& b const dlib::rectangle& b
) const ) const;
{ /*!
const double inner = a.intersect(b).area(); ensures
const double outer = (a+b).area(); - returns true if a.intersect(b).area()/(a+b).area > get_overlap_thresh()
if (inner/outer > overlap_thresh) and false otherwise. (i.e. returns true if a and b overlap enough)
return true; !*/
else
return false;
}
double get_overlap_thresh ( double get_overlap_thresh (
) const; ) const;
/*!
ensures
- returns the threshold used to determine if two rectangles overlap.
!*/
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment