1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| import numpy as np import cv2
img = cv2.imread('D1_res/watch.png',cv2.IMREAD_COLOR)
cv2.line(img,(0,0),(150,150),(255,255,255),2) cv2.rectangle(img,(50,50),(150,150),(0,0,255),2) cv2.circle(img,(100,100), 100, (0,255,0), 2)
pts = np.array([[0,0],[50,50],[100,150],[200,150]], np.int32)
cv2.polylines(img, [pts], True, (0,255,255), 3)
font = cv2.FONT_HERSHEY_SIMPLEX cv2.putText(img,'TestText',(50,50), font, 1, (200,255,155), 2, cv2.LINE_AA)
cv2.imshow('image',img) cv2.waitKey(0) cv2.destroyAllWindows()
|