#! /usr/bin/env python
# Forearm camera configuration

PACKAGE='jsk_perception'

from dynamic_reconfigure.parameter_generator_catkin import *

# SensorLevels.RECONFIGURE_RUNNING = 0

gen = ParameterGenerator()

tm_sqdiff        = gen.const("CV_TM_SQDIFF",        int_t, 0, "")
tm_sqdiff_normed = gen.const("CV_TM_SQDIFF_NORMED", int_t, 1, "default method, SSD")
tm_ccorr         = gen.const("CV_TM_CCORR",            int_t, 2, "")
tm_ccorr_normed  = gen.const("CV_TM_CCORR_NORMED",     int_t, 3, "")
tm_ccoeff        = gen.const("CV_TM_CCOEFF",        int_t, 4, "")
tm_ccoeff_normed = gen.const("CV_TM_CCOEFF_NORMED", int_t, 5, "")
match_method_enum = gen.enum([ tm_sqdiff, tm_sqdiff_normed, tm_ccorr, tm_ccorr_normed, tm_ccoeff, tm_ccoeff_normed ], "Method for match template.")

col_mono8        = gen.const("mono8",      str_t, "mono8", "")
col_bgr8         = gen.const("bgr8",       str_t, "bgr8", "")
col_bgra8        = gen.const("bgra8",      str_t, "bgra8", "")
col_hsv8         = gen.const("hsv8",       str_t, "hsv8", "")
col_hsva8        = gen.const("hsva8",      str_t, "hsva8", "")
col_enum         = gen.enum([ col_mono8, col_bgr8, col_bgra8, col_hsv8, col_hsva8 ],"color space of template match")

#       Name                        Type      Reconfiguration level          Description                          Default    Min   Max
gen.add("current_template_id",     str_t, 0, "",       "")
gen.add("match_method",            int_t, 0, "",  1,   0,   5, edit_method = match_method_enum)
gen.add("template_color_space",    str_t, 0, "",  "mono8",  edit_method = col_enum)

gen.add("show_debug_image",        bool_t,0, "Check if this node publish the debug_image",       True)
gen.add("auto_search_area",        bool_t,0, "Check if change the search area by matching result",    True)
gen.add("default_template_width",  int_t, 0, "The width for reference image",       32,   0, 128)
gen.add("default_template_height", int_t, 0, "The height for reference image",      32,   0, 128)
gen.add("default_search_width",    int_t, 0, "The width for search image",          64,   0, 256)
gen.add("default_search_height",   int_t, 0, "The height for search image",         64,   0, 256)

exit(gen.generate(PACKAGE, "matchtemplate", "matchtemplate"))
