img.shape[ : 2] 表示取彩色图片的长、宽。
img.shape[ : 3] 则表示取彩色图片的长、宽、通道。

关于img.shape[0]、[1]、[2]
img.shape[0]:图像的垂直尺寸(高度)
img.shape[1]:图像的水平尺寸(宽度)
img.shape[2]:图像的通道数

在矩阵中,[0]就表示行数,[1]则表示列数。

参考:
[1]https://www.cnblogs.com/denny402/p/5121897.html
[2]https://blog.csdn.net/u014345473/article/details/80631467
[3]https://blog.csdn.net/yournevermore/article/details/84317984

                                </div><div><div></div></div>
            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-e0530931f4.css" rel="stylesheet">
                            </div>
        </article>
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐