def image_function(self, image):
# Cast image to one of the native dtypes (one which that is supported by scipy)
image = self.cast(image)
# Take measurements
imshape = image.shape
# Obtain flows
flows = self.get_random_variable('flow_y', imshape=imshape), \
self.get_random_variable('flow_x', imshape=imshape)
# Map cooordinates from image to distorted index set
transformed_image = map_coordinates(image, flows,
mode='reflect', order=self.order).reshape(imshape)
# Uncast image to the original dtype
transformed_image = self.uncast(transformed_image)
return transformed_image
评论列表
文章目录