读图片str or file object--ndarray

scipy.ndimage.imread(*args**kwds)

imread is deprecated! imread is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use imageio.imread instead.

在1.2.0版本用imageio.imread代替

Read an image from a file as an array.从文件中把图片读成数组

This function is only available if Python Imaging Library (PIL) is installed.该功能只在安装了PIL情况下使用

Parameters:

fname : str or file object

The file name or file object to be read.

flatten : bool, optional

If True, flattens(扁平化) the color layers into a single gray-scale(灰度) layer.

将彩色层转化成单个灰度层

mode : str, optional

Mode to convert image to, e.g. 'RGB'. See the Notes for more details.

Returns:

imread : ndarray(多维数组)

The array obtained by reading the image.

Notes

imread uses the Python Imaging Library (PIL) to read an image. The following notes are from the PIL documentation.

mode can be one of the following strings:

· ‘L’ (8-bit pixels, black and white)

· ‘P’ (8-bit pixels, mapped to any other mode using a color palette)

· ‘RGB’ (3x8-bit pixels, true color)

· ‘RGBA’ (4x8-bit pixels, true color with transparency mask)

· ‘CMYK’ (4x8-bit pixels, color separation)

· ‘YCbCr’ (3x8-bit pixels, color video format)

· ‘I’ (32-bit signed integer pixels)

· ‘F’ (32-bit floating point pixels)

PIL also provides limited support for a few special modes, including ‘LA’ (‘L’ with alpha), ‘RGBX’ (true color with padding) and ‘RGBa’ (true color with premultiplied alpha).

When translating a color image to black and white (mode ‘L’, ‘I’ or ‘F’), the library uses the ITU-R 601-2 luma transform:

L = R * 299/1000 + G * 587/1000 + B * 114/1000

When flatten is True, the image is converted using mode ‘F’. When mode is not None and flatten is True, the image is first converted according to mode, and the result is then flattened using mode ‘F’.

调整图片尺寸ndarray--ndarray

scipy.misc.imresize(*args**kwds)

imresize is deprecated! imresize is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use skimage.transform.resize instead.

imresize功能将在1.2.0版本中,被skimage.transform.resize取代

Resize an image.调整图片大小

This function is only available if Python Imaging Library (PIL) is installed.该功能只在安装了PIL情况下使用

Warning

This function uses bytescale under the hood to rescale images to use the full (0, 255) range if mode is one of None, 'L', 'P', 'l'. It will also cast data for 2-D images to uint32 for mode=None (which is the default).

如果是None, 'L', 'P', 'l模式之一,该函数使用bytescale在底层调整图片,到(0, 255)全范围内。并在默认模式mode=None,计算二维图片的32位(uint32)数据。

Parameters:

arr : ndarray(多维数组)

The array of image to be resized.

size : int, float or tuple

· int - Percentage of current size.

· float - Fraction of current size.

· tuple - Size of the output image (height, width).

interp : str, optional

Interpolation to use for re-sizing (‘nearest’(最近邻插值), ‘lanczos’(lanczos兰佐斯 interpolation), ‘bilinear(双线性插值)’, ‘bicubic’(双三次插值) or ‘cubic’(三次样条插值)).

mode : str, optional

The PIL image mode (‘P’, ‘L’, etc.) to convert arr before resizing. If mode=None (the default), 2-D images will be treated like mode='L', i.e. casting to long integer. For 3-D and 4-D arrays, mode will be set to'RGB' and 'RGBA' respectively.

Returns:

imresize : ndarray

The resized array of image.

See also

toimage

Implicitly used to convert arr according to mode.

scipy.ndimage.zoom

More generic implementation that does not use PIL.

图片操作scipy.ndimage.imread和scipy.misc.imresize相关推荐

  1. scipy.ndimage.morphology

    scipy.ndimage.morphology.generate_binary_structure scipy.ndimage.morphology.generate_binary_structur ...

  2. scipy 图像处理(scipy.misc、scipy.ndimage)、matplotlib 图像处理

    from scipy.misc import imread / imsave / imshow imresize / imrotate / imfilter 1. scipy.misc 下的图像处理 ...

  3. 成功解决Exception “unhandled ImportError“cannot import name ‘imread‘ from ‘scipy.misc‘

    成功解决Exception "unhandled ImportError" cannot import name 'imread' from 'scipy.misc' 目录 解决问 ...

  4. python 读png的值变了_python – 为什么scipy.ndimage.io.imread返回PngImageFile,而不是值数组...

    您可能有一个不完整的Python成像库(PIL)安装,SciPy依赖它来读取图像. PIL依赖于libjpeg加载JPEG图像和libz来加载PNG图像,但是可以在没有任何图像的情况下安装(在这种情况 ...

  5. ImportError: cannot import name ‘imread’ from ‘scipy.misc’ 解决办法

    语句: from scipy.misc import imread 报错:ImportError: cannot import name 'imread' from 'scipy.misc' 踩坑:p ...

  6. 解决:cannot import name ‘imread’ from ‘scipy.misc’

    比如这段代码现在出现ImportError: cannot import name 'imread' from 'scipy.misc' #GovRptWordCloudv1.py import ji ...

  7. scipy笔记—scipy.misc.imresize用法(方便训练图像数据)

    scipy.misc.imresize 不同于普通的reshape, imresize不是单纯的改变图像矩阵的维度,而是能将图片重采样为指定像素,这样给深度学习中训练图像数据带来方便. import ...

  8. python《计算机视觉编程》第一章笔记——1.4.3形态学,1.4.2有用的scipy模块scipy.os模块,scipy.misc模块。1.5ROF去噪模型

    1.4.3形态学:对象计数 形态学(数学形态学):度量和分析基本形状的图像处理方法的基本框架和集合.形态学通常用来处理二值图像,也能用于灰度图像.二值图像是指图像的每个像素只能取0或1. scipy. ...

  9. scipy.ndimage.filters.gaussian_filter()

    scipy.ndimage.filters.gaussian_filter() 多维高斯滤波器 scipy.ndimage.filters.gaussian_filter(input, sigma, ...

最新文章

  1. Ubuntu查看硬件详细信息
  2. 我们在开源项目中是怎样埋彩蛋的
  3. 谷歌技术三宝之MapReduce
  4. Hibernate 小结
  5. 本地配置DNS服务器(MAC版)
  6. webpack+vue-cli 中proxyTable配置接口地址代理
  7. 又一高校学生私自返校受处分,这回连辅导员、院领导均受牵连
  8. [NVIDIA] Ububtu 获取 CUDA_ARCH
  9. java 多个项目间事物_Java-web-多个独立项目之间相互调用实践
  10. 震惊!人工智能已经发展到这个地步了
  11. C语言入门1:Hello World
  12. (二十三)Java工具类ToStringBuilder方法详解
  13. UEFI开发学习1 - Ubuntu18.04搭建edk2环境
  14. java二分法流程图,程序框图的法(二分法).ppt
  15. winform自定义控件无法显示在工具箱中以及显示但使用时出错的解决办法
  16. !!破解灯塔线取点与画线的“难点”
  17. 7个技巧让你写出干净的 TSX 代码
  18. Excel:一步搞定平均分 妙用TRIMMEAN函数(转)
  19. 单笔转账到支付宝账户接口
  20. getline()函数详解

热门文章

  1. 大学不挂科c语言题库及答案,C语言期末总复习,保你不挂科!
  2. 虚拟化 php性能测试,KVM的一些基准测试和性能测试数据分享
  3. 中国垃圾发电设备市场竞争模式与十四五运营前景研究报告2022版
  4. 全球及中国石墨烯行业发展格局及投资盈利分析报告2021年版
  5. 全球及中国自卸车行业深度分析与“十四五”发展战略规划研究报告2022-2028年版
  6. 中国二手房行业发展形势与“十四五”前景规划建议报告2022-2028年
  7. oracle mysql 数据验证工具_Oracle Orion tool check io(ORACLE Orion 工具查看以及校验IO)
  8. 秘鲁农业谋定出口-国际农民丰收节贸易会:期待对华准入
  9. 互联互通谋定贸易伙伴 国际农民丰收节贸易会品牌发展
  10. 1. CMake 系列 - 从零构建动态库和静态库