pass debug_name to convert_to_gray, tweak for adaptive threshold