Commit 4d8a070a authored by Davis King's avatar Davis King

Added another overloaded operator() to the object_detector so that it is

easy to get full_object_detections out of it.
parent a6b44e0e
......@@ -7,6 +7,7 @@
#include "../geometry.h"
#include <vector>
#include "box_overlap_testing.h"
#include "full_object_detection.h"
namespace dlib
{
......@@ -64,6 +65,15 @@ namespace dlib
double adjust_threshold = 0
);
template <
typename image_type
>
void operator() (
const image_type& img,
std::vector<std::pair<double, full_object_detection> >& final_dets,
double adjust_threshold = 0
);
template <typename T, typename U>
friend void serialize (
const object_detector<T,U>& item,
......@@ -289,6 +299,36 @@ namespace dlib
}
}
// ----------------------------------------------------------------------------------------
template <
typename image_scanner_type,
typename overlap_tester_type
>
template <
typename image_type
>
void object_detector<image_scanner_type,overlap_tester_type>::
operator() (
const image_type& img,
std::vector<std::pair<double, full_object_detection> >& final_dets,
double adjust_threshold
)
{
std::vector<std::pair<double, rectangle> > temp_dets;
(*this)(img,temp_dets,adjust_threshold);
final_dets.clear();
final_dets.reserve(temp_dets.size());
// convert all the rectangle detections into full_object_detections.
for (unsigned long i = 0; i < temp_dets.size(); ++i)
{
final_dets.push_back(std::make_pair(temp_dets[i].first,
scanner.get_full_object_detection(temp_dets[i].second, w)));
}
}
// ----------------------------------------------------------------------------------------
template <
......
......@@ -6,6 +6,7 @@
#include "../geometry.h"
#include <vector>
#include "box_overlap_testing_abstract.h"
#include "full_object_detection_abstract.h"
namespace dlib
{
......@@ -167,6 +168,26 @@ namespace dlib
objects harder while a negative one makes it easier.
!*/
template <
typename image_type
>
void operator() (
const image_type& img,
std::vector<std::pair<double, full_object_detection> >& final_dets,
double adjust_threshold = 0
);
/*!
requires
- img == an object which can be accepted by image_scanner_type::load()
ensures
- This function is identical to the above operator() routine, except that
it outputs full_object_detections instead of rectangles. This means that
the output includes part locations. In particular, calling this function
is the same as calling the above operator() routine and then using
get_scanner().get_full_object_detection() to resolve all the rectangles
into full_object_detections. Therefore, this version of operator() is
simply a convenience function for performing this set of operations.
!*/
};
// ----------------------------------------------------------------------------------------
......
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