(stroke, average_dimension=10.0)
Scale an entire image to be less than a certain size.
Scale an entire image to be less than a certain size.
Scale an entire image to be less than a certain size .
def scale_bound(stroke, average_dimension=10.0):
  """Scale an entire image to be less than a certain size."""
  # stroke is a numpy array of [dx, dy, pstate], average_dimension is a float.
  # modifies stroke directly.
  bounds = get_bounds(stroke, 1)
  max_dimension = max(bounds[1] - bounds[0], bounds[3] - bounds[2])
  stroke[:, 0:2] /= (max_dimension / average_dimension)
def scale_bound ( stroke , average_dimension = 10.0 ) : # stroke is a numpy array of [dx, dy, pstate], average_dimension is a float. # modifies stroke directly. bounds = get_bounds ( stroke , 1 ) max_dimension = max ( bounds [ 1 ] - bounds [ 0 ] , bounds [ 3 ] - bounds [ 2 ] ) stroke [ : , 0 : 2 ] /= ( max_dimension / average_dimension )