def image_function(self, image):
source_height, source_width = image.shape
target_height, target_width = self.output_image_shape
# We're on Python 3 - take a deep breath and relax.
zoom_height, zoom_width = (target_height / source_height), (target_width / source_width)
with catch_warnings():
# Ignore warning that scipy should be > 0.13 (it's 0.19 these days)
simplefilter('ignore')
rescaled_image = zoom(image, (zoom_height, zoom_width),
order=self.interpolation_order, **self.zoom_kwargs)
# This should never happen
assert_(rescaled_image.shape == (target_height, target_width),
"Shape mismatch that shouldn't have happened if you were on scipy > 0.13.0. "
"Are you on scipy > 0.13.0?",
ShapeError)
return rescaled_image
评论列表
文章目录