scipy.misc.imread函数,读取图片
发布日期:2021-06-29 11:44:33 浏览次数:3 分类:技术文章

本文共 1813 字,大约阅读时间需要 6 分钟。

import scipy.miscb=scipy.misc.imread('/home/zzp/2.jpg')

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.Returns   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.
"""    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'.    """

 

转载地址:https://blog.csdn.net/zz2230633069/article/details/82706120 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:python3 collections定义一个与一般的dic不一样的字典,OrderedDict类(有序字典),defaultdict(list)
下一篇:from torch.utils.data import DataLoader DataLoader类

发表评论

最新留言

第一次来,支持一个
[***.219.124.196]2024年04月04日 20时48分19秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章