def read_gray_img(img_path):
bgr = cv2.imread(img_path)
#bgr = cv2.resize(bgr, (225, 225))
gray = cv2.cvtColor(bgr, cv2.COLOR_BGR2GRAY)
gray_3 = cv2.cvtColor(gray, cv2.COLOR_GRAY2RGB)
print gray.shape
plt.imshow(gray_3)
plt.show()
return np.expand_dims(gray_3,0).transpose((0,3,1,2))
评论列表
文章目录