import numpy as np
import cv2
import matplotlib.pyplot as plt
from PIL import Image
img = cv2.imread('mountain1.jpg')
# Opencv uses BGR. Hence we have to convert it into RGB to get a proper output
newimg = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
# print(img.shape)
plt.imshow(newimg)
plt.show()
它在Sublime Text 3中完全可以正常工作,但在vscode中无法获得任何输出。