用户登录
用户注册

分享至

利用Python进行图像基本操作

  • 作者: 我是你二大爷啊
  • 来源: 51数据库
  • 2021-08-10

旋转图像

利用scipy库将图像进行旋转
使用格式:

scipy.ndimage.rotate(input, angle, axes=1, 0, reshape=True, output=None, order=3, mode='constant', cval=0.0, prefilter=True)

输入:
input:输入图像
angle:角度

img_45 = ndimage.rotate(img, 45, reshape=False)

将16bit图像转化为8bit

skimage.img_as_ubyte(image, force_copy=False)

如果要转化的图像最大值>255,则采取下面的方法归一化,再转化为8bit

if res.max()>255:
	res = (255*(res-res.min())/(res.max()-res.min())).astype('uint8')
软件
前端设计
程序设计
Java相关