我不明白为什么会这样
输入图片描述
src = cv2.imread('./baboon.jpg')
color1 = cv2.cvtColor(src, cv2.COLOR_BGR2RGB)
dst = np.transpose(color1)
color2 = dst.reshape(512,512,3)
images = [color1, color2]
title = ['original', 'transposed']
for i in range(2):
plt.subplot(1,2,i+1)
plt.imshow(images[i])
plt.title(title[i])
plt.axis('off')
plt.show()
src = cv2.imread('./baboon.jpg')
color1 = cv2.cvtColor(src, cv2.COLOR_BGR2RGB)
dst = np.transpose(color1, (1,0,2))
color2 = dst.reshape(512,512,3)
images = [color1, color2]
title = ['original', 'transposed']
for i in range(2):
plt.subplot(1,2,i+1)
plt.imshow(images[i])
plt.title(title[i])
plt.axis('off')
plt.show()