#!/usr/bin/env python
PACKAGE = "saliency_detector"

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

gen.add("bms_sample_step", int_t, 0, "BMS sample step", 8, 1, 20)
gen.add("bms_opening_width", int_t, 0, "BMS opening width", 13, 0, 15)
gen.add("bms_dilation_width_1", int_t, 0, "BMS dilation width 1", 0, 0, 10)
gen.add("bms_blur_std", double_t, 0, "BMS blur size", 0, 0, 10)
gen.add("bms_normalize", bool_t, 0, "Use L2 normalization for BMS", True)
gen.add("bms_handle_border", bool_t, 0, "Handle image borders", False)

gen.add("bms_thresh_fraction", double_t, 0, "Fraction between min and maxVal for threshold", 0.3, 0.0, 1.0)
gen.add("bms_thresh_on", bool_t, 0, "Threshold BMS Map", False)
gen.add("bms_top_trim", double_t, 0, "Pixels from the top of the horizon to ignore", 0, 0, 1000)
gen.add("bms_img_width", double_t, 0, "Width of computed BMS image in pixels", 600, 10, 4000)

gen.add("blobDetect_on", bool_t, 0, "Run blob detect", True)

gen.add("minDistBetweenBlobs", double_t, 0, "Minimum pixel spacing between blobs", 100, 0, 10000)

gen.add("filterByArea", bool_t, 0, "Filter blobs by area", True)
gen.add("minArea", double_t, 0, "Minimum blob area, in pixels", 2500, 1, 10000)
gen.add("maxArea", double_t, 0, "Maximum blob area, in pixels", 100000, 1, 500000)

gen.add("filterByConvexity", bool_t, 0, "Filter blobs by convexity", True)
gen.add("minConvexity", double_t, 0, "Minimum blob convexity ratio", 0.7, 0, 1.0)
gen.add("maxConvexity", double_t, 0, "Maximum blob convexity ratio", 1.0, 0, 1.0)

gen.add("minThreshold", double_t, 0, "Min blob threshold", 10, 1, 255)
gen.add("maxThreshold", double_t, 0, "Max blob threshold", 50, 1, 255)
gen.add("thresholdStep", double_t, 0, "Threshold step size", 10, 1, 255)
gen.add("minRepeatability", double_t, 0, "Min repeatability", 2, 1, 255)

gen.add("patch_scaling_factor", double_t, 0, "Amount to scale up patches from blobs", 1.5, 1.0, 5.0)

channels_enum = gen.enum([ gen.const("Vab", int_t, 0, "Value, a*, and b* for saliency"),
                           gen.const("Sab", int_t, 1, "Saturation, a*, and b* for saliency")],
                           "BMS channels")
gen.add("bms_channels", int_t, 0, "Channels to use in BMS computation", 0, 0, 1, edit_method=channels_enum)

resize_enum = gen.enum([ gen.const("Nearest", int_t, 0, "Inter_nearest for BMS resize"),
                         gen.const("Area",    int_t, 1, "Inter_area for BMS resize")],
                         "BMS resize method")
gen.add("bms_resize", int_t, 0, "Resize to use in BMS computation", 0, 0, 1, edit_method=resize_enum)

exit(gen.generate(PACKAGE, "saliency_detector", "saliency_detector_params"))
