我最怜君中宵舞 2018-12-25 15:40 采纳率: 75%
浏览 1782
已采纳

为什么将图片读取未一个数组后是一个三维的数组呢?

今天使用scikit-image读取图片后,发现图片是一个三维数组,按理解图片不该是一个二维数组么?为什么是一个三维数组呢?

  • 写回答

4条回答 默认 最新

  • Moluth 2018-12-25 08:10
    关注

    是三维没错,长,宽,通道
    通道:R(红)G(绿)B(蓝)
    或A(Alpha)R(红)G(绿)B(蓝)
    Alpha:透明度

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
  • keaiya 2018-12-25 08:28
    关注

    彩色图像有RGB三个通道,表示图像颜色

    评论
  • ethanzhangg 2019-01-09 14:01
    关注

    是三维的,正常来说(H,W,C)
    如果考虑batch-size的话,会到四维——(N,H,W,C)

    评论
  • alxe_made 2019-02-24 20:22
    关注

    例如:比如你使用skimage.io.imread函数,关于返回的是几维数据,你可以根据函数说明来,首先给出函数定义,源码,https://github.com/scikit-image/scikit-image/blob/master/skimage/io/_io.py#L14

    函数定义:

    def imread(fname, as_gray=False, plugin=None, flatten=None,
               **plugin_args):
        """Load an image from file.
        Parameters
        ----------
        fname : string
            Image file name, e.g. ``test.jpg`` or URL.
        as_gray : bool, optional
            If True, convert color images to gray-scale (64-bit floats).
            Images that are already in gray-scale format are not converted.
        plugin : str, optional
            Name of plugin to use.  By default, the different plugins are
            tried (starting with imageio) until a suitable
            candidate is found.  If not given and fname is a tiff file, the
            tifffile plugin will be used.
        Other Parameters
        ----------------
        plugin_args : keywords
            Passed to the given plugin.
        flatten : bool
            Backward compatible keyword, superseded by `as_gray`.
        Returns
        -------
        img_array : ndarray
            The different color bands/channels are stored in the
            third dimension, such that a gray-image is MxN, an
            RGB-image MxNx3 and an RGBA-image MxNx4.
    
    

    这里关于返回值明确写了:
    img_array : ndarray
    The different color bands/channels are stored in the
    third dimension, such that a gray-image is MxN, an
    RGB-image MxNx3 and an RGBA-image MxNx4.

    所以说,还是需要结合具体的函数来,而不是想当然。

    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 k210显示failed init to model
  • ¥15 Evil-droid生成的APK手机已经下载但无法建立任务
  • ¥25 c语言韩信点兵的变式
  • ¥15 怎么根据书上的例子完成这个问题呢?
  • ¥15 ECharts 增加Zoom,整行包括右边的Text一起滑动
  • ¥15 关于网上一个easyx制作的见缝插针小游戏(c++)
  • ¥15 开地址法双散列函数处理碰撞
  • ¥15 想问一下这个是什么情况 虚拟机Linux打不开了
  • ¥15 联通光猫掉注册了怎么重新注册上去
  • ¥15 关于unity开发steamvr程序遇到的问题