分类:绘图
本文实例为大家分享了OpenCv实现绘图功能的具体代码,供大家参考,具体内容如下绘制一个图像在上面画线:importnumpyasnpimportmatplotlib.pyplotaspltimportcv2#画图defshow(image):plt.imshow(image)plt.axis('off')plt.show()image=np.zeros((300,300,3),dtype='uint8')#画线green=(0,255,0)cv2.line(image,(0,0),(300,300),green)#(0,0)开始点,(300,300)是结束点#注意opencv的(0,0)点是从左上角...
继续阅读 >
茎叶图fromitertoolsimportgroupbynums2=[225,232,232,245,235,245,270,225,240,240,217,195,225,185,200,220,200,210,271,240,220,230,215,252,225,220,206,185,227,236]fork,gingroupby(sorted(nums2),key=lambdax:int(x)//10):print(k,list(g))#print('k',k)#print('g',list(g))lst=map(str,[int(y)%10foryinlist(g)])print(k,'|',''.join(lst))输出:18|5519|520|0062...
继续阅读 >
1、生成正态分布数据并绘制概率分布图importpandasaspdimportnumpyasnpimportmatplotlib.pyplotasplt#根据均值、标准差,求指定范围的正态分布概率值defnormfun(x,mu,sigma):pdf=np.exp(-((x-mu)**2)/(2*sigma**2))/(sigma*np.sqrt(2*np.pi))returnpdf#result=np.random.randint(-65,80,size=100)#最小值,最大值,数量result=np.random.normal(15,44,100)#均值为0.5,方差为1print(result)x=...
继续阅读 >
2020
10-24
2020
10-10
2020
10-10
2020
10-10