#! /usr/bin/env python

# Declare parameters that control stereo processing

PACKAGE='gpuimageproc'

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

# disparity block matching pre-filtering parameters
gen.add("xsobel", bool_t, 0, "Enable X-Sobel filter", True)
gen.add("refine_disparity", bool_t, 0, "Enable disparity refinement step", True)

# disparity block matching correlation parameters
gen.add("correlation_window_size", int_t, 0, "SAD correlation window width, pixels", 15, 5, 255)
gen.add("disparity_range",         int_t, 0, "Number of disparities to search, pixels", 64, 16, 128)
# TODO What about trySmallerWindows?

gen.add("bilateral_filter", bool_t, 0, "Enable disparity bilateral filter", False)
gen.add("filter_ndisp", int_t, 0, "Number of disparities", 64, 16, 128)
gen.add("filter_radius", int_t, 0, "Filter radius", 3, 1, 10)
gen.add("filter_iters", int_t, 0, "Filter iterations", 1, 1, 10)
gen.add("filter_edge_threshold", double_t, 0, "Filter edge threshold truncation of data continuity", 0.1, 0.001, 10)
gen.add("filter_max_disc_threshold", double_t, 0, "Filter constant to remove outliers truncation of disparity continuity", 0.2, 0.001, 10)
gen.add("filter_sigma_range", double_t, 0, "Filter range", 10, 1, 100)

# disparity block matching post-filtering parameters
# NOTE: Making uniqueness_ratio int_t instead of double_t to work around dynamic_reconfigure gui issue
gen.add("texture_threshold", double_t,  0, "0 => post procesing is disabled. If avergeTexThreshold != 0 then filter points where the image is low textured.", 10, 0, 10000)

#Speckle Filter parameters
gen.add("max_speckle_size", int_t, 0, "Max size of speckle to be removed by filter, pixels", 800, 0, 10000)
gen.add("max_diff", double_t, 0, "Max difference between pixels in the same blob", 5, 0, 50)

# First string value is node name, used only for generating documentation
# Second string value ("GPU") is name of class and generated
#    .h file, with "Config" added, so class GPUConfig
exit(gen.generate(PACKAGE, "gpuimageproc", "GPU"))
