圖檔顯示
-
示範圖片
圖片來源: openclipart
程式碼
1 2 3 4 5 6 7 8 9 10
import cv2 as cv import sys from google.colab.patches import cv2_imshow # This line imports the correct function in the Colab img = cv.imread(cv.samples.findFile("girl.png")) if img is None: sys.exit("Could not read the image.") cv2_imshow(img) # This line now uses the Colab compatible function to display the image.