Skip to content

Instantly share code, notes, and snippets.

@obafgkm44
Last active March 31, 2019 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obafgkm44/90e021a0d701b2c18132c30ad7253889 to your computer and use it in GitHub Desktop.
Save obafgkm44/90e021a0d701b2c18132c30ad7253889 to your computer and use it in GitHub Desktop.
画像のダウンロードとその画像を画面に表示させる
# 画像のダウンロード
import urllib.request as req
url = "https://amd.c.yimg.jp/amd/20190331-00000059-asahi-000-2-view.jpg"
req.urlretrieve(url,"sakura.jpg")
# ダウンロードした画像を画面に表示する
import matplotlib.pyplot as plt
import cv2
# 画像を読み込む
img = cv2.imread("sakura.jpg")
# axisの表示オフ
plt.axis("off")
plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment