diff --git a/cfg/PeopleDetect.cfg b/cfg/PeopleDetect.cfg index 5f12a0c6..bf08459c 100755 --- a/cfg/PeopleDetect.cfg +++ b/cfg/PeopleDetect.cfg @@ -39,4 +39,10 @@ from dynamic_reconfigure.parameter_generator_catkin import * gen = ParameterGenerator() gen.add("use_camera_info", bool_t, 0, "Indicates that the camera_info topic should be subscribed to to get the default input_frame_id. Otherwise the frame from the image message will be used.", True) +gen.add("hit_threshold", double_t, 150, "Threshold for the distance between features and SVM classifying plane.", 0, 0, 10) +gen.add("win_stride", int_t, 8, "Window stride. It must be a multiple of block stride.", 8, 1, 100) +gen.add("padding", int_t, 32, "Mock parameter to keep the CPU interface compatibility. It must be (0,0).", 32, 0, 128) +gen.add("scale0", double_t, 1.05, "Coefficient of the detection window increase.", 1.05, 1.0, 100.0) +gen.add("group_threshold", int_t, 2, "Coefficient to regulate the similarity threshold. When detected, some objects can be covered by many rectangles. 0 means not to perform grouping.", 2, 0, 100) + exit(gen.generate(PACKAGE, "people_detect", "PeopleDetect")) diff --git a/src/nodelet/people_detect_nodelet.cpp b/src/nodelet/people_detect_nodelet.cpp index 7eae5e2a..636f6905 100644 --- a/src/nodelet/people_detect_nodelet.cpp +++ b/src/nodelet/people_detect_nodelet.cpp @@ -73,9 +73,20 @@ class PeopleDetectNodelet : public opencv_apps::Nodelet cv::HOGDescriptor hog_; + double hit_threshold_; + int win_stride_; + int padding_; + double scale0_; + int group_threshold_; + void reconfigureCallback(people_detect::PeopleDetectConfig &new_config, uint32_t level) { config_ = new_config; + hit_threshold_ = config_.hit_threshold; + win_stride_ = config_.win_stride; + padding_ = config_.padding; + scale0_ = config_.scale0; + group_threshold_ = config_.group_threshold; } const std::string &frameWithDefault(const std::string &frame, const std::string &image_frame) @@ -122,7 +133,7 @@ class PeopleDetectNodelet : public opencv_apps::Nodelet // run the detector with default parameters. to get a higher hit-rate // (and more false alarms, respectively), decrease the hitThreshold and // groupThreshold (set groupThreshold to 0 to turn off the grouping completely). - hog_.detectMultiScale(frame, found, 0, cv::Size(8,8), cv::Size(32,32), 1.05, 2); + hog_.detectMultiScale(frame, found, hit_threshold_, cv::Size(win_stride_, win_stride_), cv::Size(padding_, padding_), scale0_, group_threshold_); t = (double)cv::getTickCount() - t; NODELET_INFO("tdetection time = %gms", t*1000./cv::getTickFrequency()); size_t i, j;