Skip to content

Commit 8682b42

Browse files
committed
match_template_nodelet.cpp: enable to select mathing method from rqt_reconfigure
1 parent 3624f77 commit 8682b42

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

cfg/MatchTemplate.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,13 @@ from dynamic_reconfigure.parameter_generator_catkin import *
3838

3939
gen = ParameterGenerator()
4040
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.", False)
41+
match_type = gen.enum([gen.const("CV_TM_SQDIFF", int_t, 0, "Sum of Ssquared Difference"),
42+
gen.const("CV_TM_SQDIFF_NORMED", int_t, 1, "Sum of Normalized Ssquared Difference"),
43+
gen.const("CV_TM_CCORR", int_t, 2, "Correlation"),
44+
gen.const("CV_TM_CCORR_NORMED", int_t, 3, "Normalized Correlation"),
45+
gen.const("CV_TM_CCOEFF", int_t, 4, "Correlation of Coefficient"),
46+
gen.const("CV_TM_CCOEFF_NORMED", int_t, 5, "Normalized Correlation of Coefficient"),
47+
], "An enum for Mathing Mehtods")
48+
gen.add("match_method", int_t, 0, "Matching Methods", 0, 0, 5, edit_method=match_type)
4149

4250
exit(gen.generate(PACKAGE, "match_template", "MatchTemplate"))

src/nodelet/match_template_nodelet.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ namespace match_template
8888
void reconfigureCallback (Config & new_config, uint32_t level)
8989
{
9090
config_ = new_config;
91+
if ( match_method_ != config_.match_method ) {
92+
match_method_ = config_.match_method;
93+
NODELET_WARN_STREAM("Change Mathing Method to " << match_method_);
94+
}
9195
}
9296

9397
const std::string & frameWithDefault (const std::string & frame, const std::string & image_frame)

0 commit comments

Comments
 (0)