I'm loading in a color image in Python OpenCV and plotting the same. However, the image I get has it's colors all mixed up.
Here is the code:
import cv2
import numpy as np
from numpy import array, arange, uint8
from matplotlib import pyplot as plt
img = cv2.imread('lena_caption.png', cv2.IMREAD_COLOR)
bw_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
images = []
images.append(img)
images.append(bw_img)
titles = ['Original Image','BW Image']
for i in xrange(len(images)):
plt.subplot(1,2,i+1),plt.imshow(images[i],'gray')
plt.title(titles[i])
plt.xticks([]),plt.yticks([])
plt.show()
Here is the original image:
And here is the plotted image:
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…