Commit 4891faec authored by Davis King's avatar Davis King

Made the object_detector's interface a little more flexible.

parent 0433da57
...@@ -59,7 +59,8 @@ namespace dlib ...@@ -59,7 +59,8 @@ namespace dlib
> >
void operator() ( void operator() (
const image_type& img, const image_type& img,
std::vector<std::pair<double, rectangle> >& final_dets std::vector<std::pair<double, rectangle> >& final_dets,
double adjust_threshold
); );
template <typename T, typename U> template <typename T, typename U>
...@@ -263,14 +264,15 @@ namespace dlib ...@@ -263,14 +264,15 @@ namespace dlib
void object_detector<image_scanner_type,overlap_tester_type>:: void object_detector<image_scanner_type,overlap_tester_type>::
operator() ( operator() (
const image_type& img, const image_type& img,
std::vector<std::pair<double, rectangle> >& final_dets std::vector<std::pair<double, rectangle> >& final_dets,
double adjust_threshold
) )
{ {
final_dets.clear(); final_dets.clear();
if (w.size() != 0) if (w.size() != 0)
{ {
std::vector<std::pair<double, rectangle> > dets; std::vector<std::pair<double, rectangle> > dets;
const double thresh = w(scanner.get_num_dimensions()); const double thresh = w(scanner.get_num_dimensions()) + adjust_threshold;
scanner.load(img); scanner.load(img);
scanner.detect(w, dets, thresh); scanner.detect(w, dets, thresh);
......
...@@ -131,7 +131,8 @@ namespace dlib ...@@ -131,7 +131,8 @@ namespace dlib
> >
void operator() ( void operator() (
const image_type& img, const image_type& img,
std::vector<std::pair<double, rectangle> >& dets std::vector<std::pair<double, rectangle> >& dets,
double adjust_threshold = 0
); );
/*! /*!
requires requires
...@@ -150,6 +151,9 @@ namespace dlib ...@@ -150,6 +151,9 @@ namespace dlib
- #get_scanner() will have been loaded with img. Therefore, you can call - #get_scanner() will have been loaded with img. Therefore, you can call
#get_scanner().get_feature_vector() to obtain the feature vectors for #get_scanner().get_feature_vector() to obtain the feature vectors for
the resulting object detection boxes. the resulting object detection boxes.
- The detection threshold is adjusted by having adjust_threshold added
to it. Therefore, an adjust_threshold value > 0 makes detecting
objects harder while a negative one makes it easier.
!*/ !*/
}; };
......
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