1. 程式人生 > 其它 >計算機視覺入門教程之載入圖片

計算機視覺入門教程之載入圖片

技術標籤:人工智慧計算機視覺opencvpython神經網路機器學習

1.安裝Ubuntu

2.安裝opencv和imutils

3.學習編寫載入圖片程式碼

# import the necessary packages
import imutils
import cv2
# load the input image and show its dimensions, keeping in mind that
# images are represented as a multi-dimensional NumPy array with
# shape no. rows (height) x no. columns (width) x no. channels (depth)
image = cv2.imread("jp.png")
(h, w, d) = image.shape
print("width={}, height={}, depth={}".format(w, h, d))
# display the image to our screen -- we will need to click the window
# open by OpenCV and press a key on our keyboard to continue execution
cv2.imshow("Image", image)
cv2.waitKey(0)

效果:

1.圖片資訊:width=533, height=300, depth=3

2.顯示圖片: