直接上代码
import cv2
import numpy as np
img=np.zeros([640,640,3]).astype(np.uint8)
img=img.ravel()for i,j inenumerate(img):if j==0:
img[i]=255
img=np.reshape(img,[640,640,3])##头for i inrange(250):
cv2.circle(img,[320,320],i,color=[255,0,0],thickness=4,lineType=16)
cv2.imshow('frams',img)
cv2.waitKey(500)##眼部旁边两条线for i inrange(130):
cv2.ellipse(img,[320,320],[250,i],180,180,0,[255,255,255],4,16)
cv2.ellipse(img,[320,320],[250,130],180,180,0,[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)##去除蓝色for i inrange(320):
cv2.ellipse(img,[320,320],[i,i],0,180,0,[255,255,255],4,16)
cv2.circle(img,[320,320],250,color=[0,0,0],thickness=4,lineType=16)
cv2.imshow('frams',img)
cv2.waitKey(500)##左眼for i inrange(50):
cv2.ellipse(img,[270,190],[110,i],90,0,360,[255,255,255],4,16)
cv2.ellipse(img,[270,190],[110,50],90,0,360,[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)##左眼中间黑点for i inrange(25):
cv2.ellipse(img,[270,190],[55,i],90,0,360,[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)##左眼眼中反光for i inrange(20):
cv2.circle(img,[290,170],i,color=[255,255,255],thickness=4,lineType=16)
cv2.imshow('frams',img)
cv2.waitKey(500)##右眼for i inrange(50):
cv2.ellipse(img,[370,190],[110, i],90,0,360,[255,255,255],4,16)
cv2.ellipse(img,[370,190],[110,50],90,0,360,[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)##鼻子for i inrange(25):
cv2.circle(img,[320,300],i,color=[0,0,255],thickness=4,lineType=16)
cv2.circle(img,[320,300],i,color=[0,0,0],thickness=4,lineType=16)
cv2.imshow('frams',img)
cv2.waitKey(500)##右眼里面
cv2.line(img,[320,200],[390,150],[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)
cv2.line(img,[320,200],[390,250],[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)##鼻子到嘴巴
cv2.line(img,[320,325],[320,460],[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)
cv2.ellipse(img,[320,350],[130,110],0,180,0,[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)#左边胡子
cv2.line(img,[230,300],[110,250],[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)
cv2.line(img,[240,320],[100,330],[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)
cv2.line(img,[220,340],[110,360],[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)#右边胡子
cv2.line(img,[430,300],[570,270],[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)
cv2.line(img,[420,320],[560,330],[0,0,0],4,16)
cv2.imshow('frams',img)
cv2.waitKey(500)
cv2.line(img,[410,340],[550,370],[0,0,0],4,16)
np.set_printoptions(threshold=np.inf)
cv2.imshow('frams',img)# cv2.imshow('frams',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
没找到opencv的填充,就直接用for循环进行颜色填充。
for循环进行颜色填充,其他的都是描线。
效果图如下(实际上是动态图
最后使用pyinstaller转化成exe文件可以看我之前的文章
这里
本文转载自: https://blog.csdn.net/darlingqx/article/details/127290821
版权归原作者 月明Mo 所有, 如有侵权,请联系我们删除。
版权归原作者 月明Mo 所有, 如有侵权,请联系我们删除。