zoukankan      html  css  js  c++  java
  • 『Python』skimage图像处理_旋转图像

    一段简短的实现图像旋转的代码,使用了skimage库,据说和PIL相比,skimage对numpy等科学计算库的支持更好,这里是为了完成师兄给的帮他修改程序的任务,如果以后有需求的话可能会对python图像处理库做个梳理或者根据自己的需求做个筛选后深入了解一下。

     1 from skimage import io,transform
     2 import matplotlib.pyplot as plt
     3 
     4 
     5 '''图片旋转'''
     6 
     7 img2 = io.imread('./bg-body-3.jpg')
     8 img2 =transform.rotate(img2, 180)     #旋转180度,不改变大小
     9 plt.figure('skimage')
    10 plt.imshow(img2)
    11 plt.show()
    12 print(img2.shape)
    13 print(img2.dtype)

    这个库会把读入的图片数据直接转化为numpy.ndarray,并将数据类型由uint8转化为float64:

    输出;

    (983, 1920, 3)
    float64
    
  • 相关阅读:
    ansible-乱
    linux-PXE-12
    linux-ntp-10
    linux-selinxu---性能 -8
    linux-系统启动流程-7
    linux-网络管理-6
    linux-文件系统-5
    linux-包管理器-4
    linux-shell脚本基础-2
    linux-history-ps1-1
  • 原文地址:https://www.cnblogs.com/hellcat/p/6850602.html
Copyright © 2011-2022 走看看