Added a missing assert and fixed some typos.

This commit is contained in:
Davis King 2011-09-08 22:16:44 -04:00
parent ae0c81bc76
commit 4e2ab80eb0
3 changed files with 17 additions and 7 deletions

View File

@ -151,6 +151,17 @@ namespace dlib
boxes_overlap(overlap_tester), boxes_overlap(overlap_tester),
w(w_) w(w_)
{ {
// make sure requires clause is not broken
DLIB_ASSERT(scanner_.get_num_detection_templates() > 0 &&
w_.size() == scanner.get_num_dimensions() + 1,
"\t object_detector::object_detector(scanner_,overlap_tester,w_)"
<< "\n\t Invalid inputs were given to this function "
<< "\n\t scanner_.get_num_detection_templates(): " << scanner_.get_num_detection_templates()
<< "\n\t w_.size(): " << w_.size()
<< "\n\t scanner_.get_num_dimensions(): " << scanner_.get_num_dimensions()
<< "\n\t this: " << this
);
scanner.copy_configuration(scanner_); scanner.copy_configuration(scanner_);
} }

View File

@ -20,13 +20,12 @@ namespace dlib
{ {
/*! /*!
REQUIREMENTS ON overlap_tester_type REQUIREMENTS ON overlap_tester_type
overlap_tester_type must be a type with an interface compatible overlap_tester_type must be an implementation of the test_box_overlap
with test_box_overlap. object defined in dlib/image_processing/box_overlap_testing_abstract.h.
REQUIREMENTS ON image_scanner_type REQUIREMENTS ON image_scanner_type
image_scanner_type must be an instance of the scan_image_pyramid image_scanner_type must be an implementation of
templated defined in dlib/image_processing/scan_image_pyramid_abstract.h dlib/image_processing/scan_image_pyramid_abstract.h
or an object with a compatible interface.
WHAT THIS OBJECT REPRESENTS WHAT THIS OBJECT REPRESENTS
This object is a tool for detecting the positions of objects in This object is a tool for detecting the positions of objects in
@ -61,7 +60,7 @@ namespace dlib
/*! /*!
requires requires
- w.size() == scanner.get_num_dimensions() + 1 - w.size() == scanner.get_num_dimensions() + 1
- scanner.num_detection_templates() > 0 - scanner.get_num_detection_templates() > 0
ensures ensures
- When the operator() member function is called it will - When the operator() member function is called it will
invoke scanner.detect(w,dets,w(w.size()-1)), suppress invoke scanner.detect(w,dets,w(w.size()-1)), suppress

View File

@ -67,7 +67,7 @@ namespace dlib
/*! /*!
requires requires
- images.size() == truth_rects.size() - images.size() == truth_rects.size()
- scanner.num_detection_templates() > 0 - scanner.get_num_detection_templates() > 0
ensures ensures
- This object attempts to learn a mapping from the given images to the - This object attempts to learn a mapping from the given images to the
object locations given in truth_rects. In particular, it attempts to object locations given in truth_rects. In particular, it attempts to