1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| # 1. Paing the Image a certain colour
blank[200:300, 100:200] = 0,255,255
cv2.imshow('Green', blank)
# 2. Draw a Rectangle
cv2.rectangle(blank, (0,0), (250,250), (0,255,0), thickness=cv2.FILLED)
cv2.imshow('Rectangle', blank)
# 3. Draw a circle
cv2.circle(blank, (40,40), 40, (0,0,255), thickness=3)
cv2.imshow('Circle', blank)
# 4. Draw a line
cv2.line(blank, (0,0), (40, 40), (255,0,0), thickness=3)
cv2.imshow('line', blank)
# 5. Write text
cv2.putText(blank, "Hello, World!", (255,255), cv2.FONT_HERSHEY_TRIPLEX, 1.0, (0,255,255), 2)
cv2.imshow('text', blank)
|