-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcx.py
More file actions
23 lines (21 loc) · 731 Bytes
/
Copy pathcx.py
File metadata and controls
23 lines (21 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import argparse
import cv2
import numpy as np
parser = argparse.ArgumentParser(
prog='CX',
description='My avatar.',
epilog='help')
parser.add_argument('-n', type=int, default=512, help='length')
parser.add_argument('-opacity', type=int, metavar='[0-255]', default=255, help='opacity')
args = parser.parse_args()
n = args.n
opacity = args.opacity
array = np.ones((n, n, 4), np.uint8)
array *= opacity
thickness = max(1, n // 128)
cv2.ellipse(array, (n // 2, n // 2), (n // 2, n // 2), 0, 90, 270, (0, 0, 0), thickness)
cv2.line(array, (n, 0), (n // 2, n), (0, 0, 0), thickness)
cv2.line(array, (n // 2, 0), (n, n), (0, 0, 0), thickness)
cv2.imwrite(f'CX{n}.png', array)
cv2.imshow(f'CX{n}.png', array)
cv2.waitKey(0)