国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > Python > 正文

python調用Matplotlib繪制分布點圖

2024-09-09 19:02:11
字體:
來源:轉載
供稿:網友

Python調用Matplotlib代碼繪制分布點,供大家參考,具體內容如下

繪制點圖的目的 Matplotlib簡介 代碼 截圖

1.繪制點圖的目的

我們實驗室正在做關于人臉識別的項目,其中在人臉檢測后,會有些誤檢的圖片,但是其中就有很多不符合的。很明顯的是從圖片大小,就可以過濾掉一部分。老大交給我的工作,就是通過繪制圖片width,height的分布圖,來找到一個合理的閾值。

2.Matlablib簡介

Matplotlib是一個Python的圖形框架

下面是官網的例子

Matplotlib example

3.代碼如下

import matplotlib.pyplot as pltfrom numpy.random import randimport numpyimport osimport cv2#setting pltplt.xlim(xmax=500,xmin=0)plt.ylim(ymax=500,ymin=0)plt.xlabel("height")plt.ylabel("width")path_1 = r'D:/zhangjichao/view/path_1'x = []y = []files = os.listdir(path_1)for f in files:  img = cv2.imread(path_1 + '//' + f)  x.append(img.shape[0])  y.append(img.shape[1])plt.plot(x,y,'ro',color='red',label='path_1')path_2 = r'D:/zhangjichao/view/path_2'x = []y = []files = os.listdir(path_2)for f in files:  img = cv2.imread(path_2 + '//' + f)  x.append(img.shape[0])  y.append(img.shape[1])plt.plot(x,y,'ro',color='red',label='path_2')path_3 = r'D:/zhangjichao/view/path_3'x = []y = []files = os.listdir(path_3)for f in files:  img = cv2.imread(path_3 + '//' + f)  x.append(img.shape[0])  y.append(img.shape[1])plt.plot(x,y,'ro',color='red',label='path_3')path_4 = r'D:/zhangjichao/view/path_4'x = []y = []files = os.listdir(path_4)for f in files:  img = cv2.imread(path_4 + '//' + f)  x.append(img.shape[0])  y.append(img.shape[1])plt.plot(x,y,'ro',color='red',label='path_4')yujing = r'D:/zhangjichao/view/xujing'x = []y = []files = os.listdir(yujing)for f in files:  img = cv2.imread(yujing + '//' + f)  x.append(img.shape[0])  y.append(img.shape[1])plt.plot(x,y,'ro',color='green' , label='yujing')#圖例plt.legend(loc='upper center', shadow=True, fontsize='x-large')plt.grid(True)#顯示plt.show()

4.顯示結果

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網之家。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 邹平县| 玉树县| 如东县| 长沙市| 綦江县| 离岛区| 房山区| 宁远县| 古交市| 安陆市| 汉中市| 禄劝| 崇阳县| 荃湾区| 苗栗县| 明星| 阿拉善右旗| 永康市| 方城县| 莱西市| 集安市| 大兴区| 利辛县| 海淀区| 广州市| 霞浦县| 麻江县| 郎溪县| 大城县| 河南省| 随州市| 宣汉县| 拉孜县| 楚雄市| 岐山县| 固始县| 扎囊县| 静海县| 繁昌县| 景泰县| 平潭县|