久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

python將圖片轉(zhuǎn)為矢量圖的方法步驟

瀏覽:106日期:2022-06-23 17:23:58

本文主要介紹了python圖片轉(zhuǎn)為矢量圖,分享給大家,具體如下:

import numpy as npimport matplotlib.pyplot as pltimport cv2fig, ax = plt.subplots()plt.figure(1)image=cv2.imread('2.jpg')# you can specify the marker size two ways directly:# 這樣一個(gè)一個(gè)像素太慢了故而要將同樣顏色的坐標(biāo)進(jìn)行分類處理color_class=[]x_y=dict()for x,w in enumerate(image): for y,colors in enumerate(w): if colors.tolist() not in color_class: s=image[:, :, :1] == colors[0] s1=image[:, :, 1:2] == colors[1] s2=image[:, :, 2:3] == colors[2] ss=s*s1*s2 color_class.append(colors.tolist()) x_y[len(color_class)]=np.where(ss.reshape((ss.shape[0],ss.shape[1]))) print(x,y)for i ,colors in enumerate(color_class): a, b = x_y[i + 1] plt.plot(a,b, '.',color=[colors[2]/255,colors[1]/255,colors[0]/255], markersize=1, label=’a’) # blue circle with size 20fig.savefig(’scatter.svg’, dpi=200, format=’svg’)if __name__ == ’__main__’: pass

到此這篇關(guān)于python將圖片轉(zhuǎn)為矢量圖的方法步驟的文章就介紹到這了,更多相關(guān)python圖片轉(zhuǎn)為矢量圖內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 东兴市| 和龙市| 江城| 临颍县| 南投县| 潍坊市| 正宁县| 巫溪县| 佳木斯市| 甘肃省| 合山市| 淳安县| 循化| 潼南县| 太保市| 凌海市| 三台县| 阿拉尔市| 嘉鱼县| 秀山| 怀安县| 泰顺县| 方山县| 大庆市| 六安市| 高安市| 微山县| 奉化市| 张家口市| 通州区| 永昌县| 湘潭市| 杭州市| 台北市| 府谷县| 玉山县| 黔东| 慈利县| 泾阳县| 安丘市| 通渭县|