前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >scipy.misc.imread()

scipy.misc.imread()

作者头像
狼啸风云
修改2022-09-03 20:27:36
1.5K0
修改2022-09-03 20:27:36
举报
文章被收录于专栏:计算机视觉理论及其实现
代码语言:javascript
复制
import scipy.misc
b=scipy.misc.imread('/home/zzp/2.jpg')
代码语言:javascript
复制
scipy.misc.imread(name, flatten=False, mode=None)

read a image from a file as an array将图片读取出来为array类型,即numpy类型

参数:

  • name : 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.

返回值:

  •     imread : ndarray. The array obtained by reading the image.

 mode详细信息:

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

代码语言:javascript
复制
"""
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'.
"""
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/10/24 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档