Example #1
0
def gauss_pyramid(image, levels):
  '''Construct a pyramid from the image, of height levels.

  image - an image of dimension (r,c) and dtype float.
  levels - a positive integer that specifies the number of reductions you should
           do. So, if levels = 0, you should return a list containing just the
           input image. If levels = 1, you should do one reduction, etc.
           len(output) = levels + 1
  output - a list of arrays of dtype np.float. The first element of the list is
           layer 0 of the pyramid (the image itself). output[1] is layer 1 of the
           pyramid (image reduced once), etc.

  Consult the lecture and tutorial videos for more details about Gaussian Pyramids.
  '''
  output = [[] for i in range(levels+1)]
  output[0] = image
  for i in range(1, levels+1):
    output[i] = part0.reduce(output[i-1])
  return output
Example #2
0
def gauss_pyramid(image, levels):
  '''
  Construct a pyramid from the image, of height levels.

  image - an image of dimension (r,c) and dtype float.
  levels - a positive integer that specifies the number of reductions you should 
           do. So, if levels = 0, you should return a list containing just the 
           input image. If levels = 1, you should do one reduction, etc. 
           len(output) = levels + 1
  output - a list of arrays of dtype np.float. The first element of the list is
           layer 0 of the pyramid (the image itself). output[1] is layer 1 of the
           pyramid (image reduced once), etc.

  '''
  output = [image]
  last_image = image
  for i in range(levels):
    last_image = part0.reduce(last_image);
    output.append(last_image)
  return output