import numpy as np
import cv2
img=np.ones((512,512,3),np.uint8)*255
def ring(position, color):
cv2.circle(img,position,60,color,-1)
cv2.circle(img,position,25,(255,255,255),-1)
green = (255,0,0)
blue = (0,255,0)
red = (0,0,255)
position1 = (256,100)
position2 = (181,228)
position3 = (331,228)
ring(position1, red)
ring(position2, green)
ring(position3, blue)
tri1=np.array([[256,100],[219,164],[293,164]],np.int32)
tri2=np.array([[181,228],[256,228],[218,164]],np.int32)
tri3=np.array([[331,228],[368,164],[293,164]],np.int32)
cv2.fillPoly(img,[tri1,tri2,tri3],(255,255,255));
font=cv2.FONT_HERSHEY_SIMPLEX
cv2.putText(img,'OpenCV',(121,350),font,2.3,(0,0,0),10)
cv2.imshow('image',img)
k = cv2.waitKey(0) & 0xFF
if k == 27: # wait for ESC key to exit
cv2.destroyAllWindows()
elif k == ord('s'): # wait for 's' key to save and exit
cv2.imwrite('opencvlogo.png',img)
cv2.destroyAllWindows()
import cv2
img=np.ones((512,512,3),np.uint8)*255
def ring(position, color):
cv2.circle(img,position,60,color,-1)
cv2.circle(img,position,25,(255,255,255),-1)
green = (255,0,0)
blue = (0,255,0)
red = (0,0,255)
position1 = (256,100)
position2 = (181,228)
position3 = (331,228)
ring(position1, red)
ring(position2, green)
ring(position3, blue)
tri1=np.array([[256,100],[219,164],[293,164]],np.int32)
tri2=np.array([[181,228],[256,228],[218,164]],np.int32)
tri3=np.array([[331,228],[368,164],[293,164]],np.int32)
cv2.fillPoly(img,[tri1,tri2,tri3],(255,255,255));
font=cv2.FONT_HERSHEY_SIMPLEX
cv2.putText(img,'OpenCV',(121,350),font,2.3,(0,0,0),10)
cv2.imshow('image',img)
k = cv2.waitKey(0) & 0xFF
if k == 27: # wait for ESC key to exit
cv2.destroyAllWindows()
elif k == ord('s'): # wait for 's' key to save and exit
cv2.imwrite('opencvlogo.png',img)
cv2.destroyAllWindows()