repair old interface

This commit is contained in:
Jack Culpepper 2015-03-12 08:10:56 +00:00
parent f2f4e9d0bf
commit a12e1e71fa
2 changed files with 24 additions and 9 deletions

View File

@ -342,7 +342,7 @@ ensures \n\
"Loads an object detector from a file that contains the output of the \n\ "Loads an object detector from a file that contains the output of the \n\
train_simple_object_detector() routine or a serialized C++ object of type\n\ train_simple_object_detector() routine or a serialized C++ object of type\n\
object_detector<scan_fhog_pyramid<pyramid_down<6>>>.") object_detector<scan_fhog_pyramid<pyramid_down<6>>>.")
.def("__call__", run_detector_with_upscale, (arg("image"), arg("upsample_num_times")=0), .def("__call__", run_detector_with_upscale2, (arg("image"), arg("upsample_num_times")=0),
"requires \n\ "requires \n\
- image is a numpy ndarray containing either an 8bit grayscale or RGB \n\ - image is a numpy ndarray containing either an 8bit grayscale or RGB \n\
image. \n\ image. \n\

View File

@ -32,7 +32,8 @@ namespace dlib
} }
} }
inline std::vector<dlib::rectangle> run_detector_with_upscale (
inline std::vector<dlib::rectangle> run_detector_with_upscale1 (
dlib::simple_object_detector& detector, dlib::simple_object_detector& detector,
boost::python::object img, boost::python::object img,
const unsigned int upsampling_amount, const unsigned int upsampling_amount,
@ -111,10 +112,23 @@ namespace dlib
} }
} }
inline std::vector<dlib::rectangle> run_detector_with_upscale2 (
dlib::simple_object_detector& detector,
boost::python::object img,
const unsigned int upsampling_amount
)
{
std::vector<double> detection_confidences;
std::vector<double> weight_indices;
return run_detector_with_upscale1(detector, img, upsampling_amount,
detection_confidences, weight_indices);
}
inline boost::python::tuple run_rect_detector ( inline boost::python::tuple run_rect_detector (
dlib::simple_object_detector& detector, dlib::simple_object_detector& detector,
boost::python::object img, boost::python::object img,
const unsigned int upsampling_amount) const unsigned int upsampling_amount)
{ {
boost::python::tuple t; boost::python::tuple t;
@ -122,8 +136,8 @@ namespace dlib
std::vector<double> weight_indices; std::vector<double> weight_indices;
std::vector<rectangle> rectangles; std::vector<rectangle> rectangles;
rectangles = run_detector_with_upscale(detector, img, upsampling_amount, rectangles = run_detector_with_upscale1(detector, img, upsampling_amount,
detection_confidences, weight_indices); detection_confidences, weight_indices);
return boost::python::make_tuple(rectangles, return boost::python::make_tuple(rectangles,
detection_confidences, weight_indices); detection_confidences, weight_indices);
@ -144,7 +158,7 @@ namespace dlib
std::vector<double> detection_confidences; std::vector<double> detection_confidences;
std::vector<double> weight_indices; std::vector<double> weight_indices;
return run_detector_with_upscale(detector, img, upsampling_amount_, return run_detector_with_upscale1(detector, img, upsampling_amount_,
detection_confidences, weight_indices); detection_confidences, weight_indices);
} }
@ -152,7 +166,8 @@ namespace dlib
{ {
std::vector<double> detection_confidences; std::vector<double> detection_confidences;
std::vector<double> weight_indices; std::vector<double> weight_indices;
return run_detector_with_upscale(detector, img, upsampling_amount,
return run_detector_with_upscale1(detector, img, upsampling_amount,
detection_confidences, weight_indices); detection_confidences, weight_indices);
} }