53
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PythonとOpenCVでいのちを輝かせる

Last updated at Posted at 2020-08-27

まずは背景の白色画像

import numpy as np
import matplotlib.pyplot as plt
import cv2

# back groud
back = np.ones((512, 512, 3), np.uint8) * 255

plt.imshow(back)
plt.show();

download.png

次にいのち本体

# red circle
cv2.circle(back, (80, 160), 53, (231, 0, 18), -1)
cv2.circle(back, (160, 186), 47, (231, 0, 18), -1)
cv2.circle(back, (162, 115), 47, (231, 0, 18), -1)
cv2.circle(back, (225, 60), 50, (231, 0, 18), -1)
cv2.circle(back, (330, 90), 65, (231, 0, 18), -1)
cv2.ellipse(back, (380, 170), (76, 36), 0, 0, 360, (231, 0, 18), -1)
cv2.ellipse(back, (370, 250), (45, 55), 0, 0, 360, (231, 0, 18), -1)
cv2.ellipse(back, (352, 350), (70, 65), 0, 0, 360, (231, 0, 18), -1)
cv2.circle(back, (262, 422), 66, (231, 0, 18), -1)
cv2.circle(back, (170, 408), 46, (231, 0, 18), -1)
cv2.ellipse(back, (128, 340), (30, 54), 0, 0, 360, (231, 0, 18), -1)
cv2.circle(back, (95, 258), 60, (231, 0, 18), -1)

plt.imshow(back)
plt.show();

download-1.png

最後に目!

# eyes
cv2.circle(back, (68, 152), 28, (255, 255, 255), -1)
cv2.circle(back, (56, 144), 13, (29, 143, 255), -1)

cv2.circle(back, (350, 70), 28, (255, 255, 255), -1)
cv2.circle(back, (360, 60), 13, (29, 143, 255), -1)

cv2.circle(back, (350, 70), 28, (255, 255, 255), -1)
cv2.circle(back, (360, 60), 13, (29, 143, 255), -1)

cv2.ellipse(back, (378, 355), (33, 30), 0, 0, 360, (255, 255, 255), -1)
cv2.circle(back, (392, 350), 15, (29, 143, 255), -1)

cv2.circle(back, (253, 442), 25, (255, 255, 255), -1)
cv2.circle(back, (253, 454), 10, (29, 143, 255), -1)

cv2.circle(back, (253, 442), 25, (255, 255, 255), -1)
cv2.circle(back, (253, 454), 10, (29, 143, 255), -1)

cv2.circle(back, (105, 275), 26, (255, 255, 255), -1)
cv2.circle(back, (103, 263), 12, (29, 143, 255), -1)

plt.imshow(back)
plt.show();

download-2.png

見事に輝くいのちの誕生です!祝大阪万博 :qiitan-cry:

追記(2021/09/27)

 プロ野球データの可視化サイト を作りました。まだまだクオリティは低いですが、今後少しずつバージョンアップさせていく予定です。野球好きの方は是非遊びに来てください⚾️

image.png

53
24
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
53
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?