def pyramid_laplacian(image, max_layer=(-1), downscale=2, sigma=None, order=1, mode='reflect', cval=0):
 _check_factor(downscale)
 image = img_as_float(image)
 if (sigma is None):
  sigma = ((2 * downscale) / 6.0)
 layer = 0
 rows = image.shape[0]
 cols = image.shape[1]
 smoothed_image = _smooth(image, sigma, mode, cval)
 (yield (image - smoothed_image))
 while (layer != max_layer):
  layer += 1
  out_rows = math.ceil((rows / float(downscale)))
  out_cols = math.ceil((cols / float(downscale)))
  resized_image = resize(smoothed_image, (out_rows, out_cols), order=order, mode=mode, cval=cval)
  smoothed_image = _smooth(resized_image, sigma, mode, cval)
  prev_rows = rows
  prev_cols = cols
  rows = resized_image.shape[0]
  cols = resized_image.shape[1]
  if ((prev_rows == rows) and (prev_cols == cols)):
   break
  (yield (resized_image - smoothed_image))

def pyramid_laplacian ( image , max_layer = ( - 1 ) , downscale = 2 , sigma = None , order = 1 , mode = 'reflect' , cval = 0 ) : _check_factor ( downscale ) image = img_as_float ( image ) if ( sigma is None ) : sigma = ( ( 2 * downscale ) / 6.0 ) layer = 0 rows = image . shape [ 0 ] cols = image . shape [ 1 ] smoothed_image = _smooth ( image , sigma , mode , cval ) ( yield ( image - smoothed_image ) ) while ( layer != max_layer ) : layer += 1 out_rows = math . ceil ( ( rows / float ( downscale ) ) ) out_cols = math . ceil ( ( cols / float ( downscale ) ) ) resized_image = resize ( smoothed_image , ( out_rows , out_cols ) , order = order , mode = mode , cval = cval ) smoothed_image = _smooth ( resized_image , sigma , mode , cval ) prev_rows = rows prev_cols = cols rows = resized_image . shape [ 0 ] cols = resized_image . shape [ 1 ] if ( ( prev_rows == rows ) and ( prev_cols == cols ) ) : break ( yield ( resized_image - smoothed_image ) )
yield images of the laplacian pyramid formed by the input image .