影像作為資料:視覺化
若要顯示影像資料,你會使用 Python 的 Matplotlib 函式庫,特別是其中的 pyplot 子模組,它包含許多繪圖指令。其中有些指令可用來顯示儲存在陣列中的影像內容。
本練習屬於課程
使用 Keras 進行影像建模
練習說明
- 將檔案
bricks.png中的影像匯入到data。 - 在螢幕上顯示
data中的影像。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Import matplotlib
import matplotlib.pyplot as plt
# Load the image
data = plt.____('bricks.png')
# Display the image
plt.____(____)
plt.show()