Commit 967b5215 authored by Davis King's avatar Davis King

Upgraded the object_detector. Now it can store multiple weight vectors and hence

multiple object detectors.
parent 8194f4ab
This diff is collapsed.
......@@ -865,19 +865,27 @@ namespace dlib
>
matrix<unsigned char> draw_fhog (
const object_detector<scan_fhog_pyramid<Pyramid_type> >& detector,
const unsigned long weight_index = 0,
const long cell_draw_size = 15
)
{
// make sure requires clause is not broken
DLIB_ASSERT(cell_draw_size > 0 && detector.get_w().size() >= detector.get_scanner().get_num_dimensions() ,
DLIB_ASSERT(weight_index < detector.num_detectors(),
"\t matrix draw_fhog()"
<< "\n\t Invalid arguments were given to this function. "
<< "\n\t cell_draw_size: " << cell_draw_size
<< "\n\t detector.get_w().size(): " << detector.get_w().size()
<< "\n\t detector.num_detectors(): " << detector.num_detectors()
);
DLIB_ASSERT(cell_draw_size > 0 && detector.get_w(weight_index).size() >= detector.get_scanner().get_num_dimensions(),
"\t matrix draw_fhog()"
<< "\n\t Invalid arguments were given to this function. "
<< "\n\t cell_draw_size: " << cell_draw_size
<< "\n\t weight_index: " << weight_index
<< "\n\t detector.get_w(weight_index).size(): " << detector.get_w(weight_index).size()
<< "\n\t detector.get_scanner().get_num_dimensions(): " << detector.get_scanner().get_num_dimensions()
);
typename scan_fhog_pyramid<Pyramid_type>::fhog_filterbank fb = detector.get_scanner().build_fhog_filterbank(detector.get_w());
typename scan_fhog_pyramid<Pyramid_type>::fhog_filterbank fb = detector.get_scanner().build_fhog_filterbank(detector.get_w(weight_index));
return draw_fhog(fb.get_filters(),cell_draw_size);
}
......
......@@ -17,18 +17,21 @@ namespace dlib
>
matrix<unsigned char> draw_fhog (
const object_detector<scan_fhog_pyramid<Pyramid_type> >& detector,
const unsigned long weight_index = 0,
const long cell_draw_size = 15
);
/*!
requires
- cell_draw_size > 0
- weight_index < detector.num_detectors()
- detector.get_w().size() >= detector.get_scanner().get_num_dimensions()
(i.e. the detector must have been populated with a HOG filter)
ensures
- Converts the HOG filters in the given detector into an image suitable for
display on the screen. In particular, we draw all the HOG cells into a
grayscale image in a way that shows the magnitude and orientation of the
gradient energy in each cell. The resulting image is then returned.
- Converts the HOG filters in the given detector (specifically, the filters in
detector.get_w(weight_index)) into an image suitable for display on the
screen. In particular, we draw all the HOG cells into a grayscale image in a
way that shows the magnitude and orientation of the gradient energy in each
cell. The resulting image is then returned.
!*/
// ----------------------------------------------------------------------------------------
......
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