我是靠谱客的博主 正直绿草,这篇文章主要介绍灰度图像img.shape、(height, width)转为(height, width, channels),现在分享给大家,希望可以做个参考。

from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import cv2
img = ‘./control23.tif’
img = Image.open(img)
img = np.array(img)
print(img.shape)
img=np.stack((img,)*3,axis=-1)
print(img.shape)
plt.imshow(img)

在这里插入图片描述

最后

以上就是正直绿草最近收集整理的关于灰度图像img.shape、(height, width)转为(height, width, channels)的全部内容,更多相关灰度图像img.shape、(height,内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(99)

评论列表共有 0 条评论

立即
投稿
返回
顶部