Python 图像处理
Rebeca Gonzalez
Data Engineer





from skimage.transform import rotate# 将图像顺时针旋转 90 度 image_rotated = rotate(image, -90)show_image(image, 'Original') show_image(image_rotated, 'Rotated 90 degrees clockwise')

from skimage.transform import rotate# 将图像逆时针旋转 90 度 image_rotated = rotate(image, 90)show_image(image, 'Original') show_image(image_rotated, 'Rotated 90 degrees anticlockwise')


from skimage.transform import rescale# 将图像缩小为原来的 1/4 大小 image_rescaled = rescale(image, 1/4, anti_aliasing=True, multichannel=True)show_image(image, 'Original image') show_image(image_rescaled, 'Rescaled image')




from skimage.transform import resize# 目标高度与宽度 height = 400 width = 500# 调整尺寸 image_resized = resize(image, (height, width), anti_aliasing=True)# 显示原图与结果图 show_image(image, 'Original image') show_image(image_resized, 'Resized image')

from skimage.transform import resize# 按比例设置高度和宽度为原来的 1/4 height = image.shape[0] / 4 width = image.shape[1] / 4# 调整尺寸 image_resized = resize(image, (height, width), anti_aliasing=True)show_image(image_resized, 'Resized image')

Python 图像处理