我正在使用以下代码阅读灰度图像:
import pylab as plt
. . .
circle_image = plt.imread(image_gray) #this dimension is 120,120
print(circle_image.shape) # prints (120,120)
plt.imshow(circle_image)
plt.show()
我使用以下内容将其大小调整为256x256:
resized_circle_image = misc.imresize(circle_image, (256,256)) # i tried using (256,256,3) but that generates resized image of (256, 256) only
print(resized_circle_image.shape) # prints (256,256)
plt.imshow(resized_circle_image)
plt.show()
我必须将此图像与形状为(256,256,3)
的彩色图像连接起来。如何从无通道转换为3通道图像格式?
我尝试了什么:
a = np.resize(resized_circle_image, (256, 256, 3))