Python圖像處理模塊ndimage用法實(shí)例分析
本文實(shí)例講述了Python圖像處理模塊ndimage用法。分享給大家供大家參考,具體如下:
一 原始圖像
1 代碼
from scipy import misc from scipy import ndimage import matplotlib.pyplot as plt face = misc.face()#face是測(cè)試圖像之一 plt.figure()#創(chuàng)建圖形 plt.imshow(face)#繪制測(cè)試圖像 plt.show()#原始圖像
2 運(yùn)行結(jié)果

二 高斯濾波
1 代碼
from scipy import misc from scipy import ndimage import matplotlib.pyplot as plt face = misc.face()#face是測(cè)試圖像之一 plt.figure()#創(chuàng)建圖形 blurred_face = ndimage.gaussian_filter(face, sigma=7)#高斯濾波 plt.imshow(blurred_face) plt.show()
2 運(yùn)行結(jié)果

三 邊緣銳化處理
1 代碼
from scipy import misc from scipy import ndimage import matplotlib.pyplot as plt face = misc.face()#face是測(cè)試圖像之一 plt.figure()#創(chuàng)建圖形 blurred_face1 = ndimage.gaussian_filter(face, sigma=1)#邊緣銳化 blurred_face3 = ndimage.gaussian_filter(face, sigma=3) sharp_face = blurred_face3 +6*(blurred_face3-blurred_face1) plt.imshow(sharp_face) plt.show()
2 運(yùn)行結(jié)果

四 中值濾波
1 代碼
from scipy import misc from scipy import ndimage import matplotlib.pyplot as plt face = misc.face()#face是測(cè)試圖像之一 plt.figure()#創(chuàng)建圖形 median_face = ndimage.median_filter(face,7)#中值濾波 plt.imshow(median_face) plt.show()
2 運(yùn)行結(jié)果

更多關(guān)于Python相關(guān)內(nèi)容可查看本站專題:《Python圖片操作技巧總結(jié)》、《Python數(shù)據(jù)結(jié)構(gòu)與算法教程》、《Python函數(shù)使用技巧總結(jié)》、《Python字符串操作技巧匯總》及《Python入門與進(jìn)階經(jīng)典教程》
希望本文所述對(duì)大家Python程序設(shè)計(jì)有所幫助。
相關(guān)文章
Pandas統(tǒng)計(jì)計(jì)數(shù)value_counts()的使用
本文主要介紹了Pandas統(tǒng)計(jì)計(jì)數(shù)value_counts()的使用,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-07-07
Python的Django框架實(shí)現(xiàn)數(shù)據(jù)庫查詢(不返回QuerySet的方法)
這篇文章主要介紹了Python的Django框架實(shí)現(xiàn)數(shù)據(jù)庫查詢(不返回QuerySet的方法)2020-05-05
Python OpenCV 使用滑動(dòng)條來調(diào)整函數(shù)參數(shù)的方法
這篇文章主要介紹了Python OpenCV 使用滑動(dòng)條來調(diào)整函數(shù)參數(shù)的方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-07-07
利用Python中的pandas庫對(duì)cdn日志進(jìn)行分析詳解
這篇文章主要介紹了利用Python中的pandas庫進(jìn)行cdn日志分析的相關(guān)資料,文中分享了pandas對(duì)cdn日志分析的完整示例代碼,然后詳細(xì)介紹了關(guān)于pandas庫的相關(guān)內(nèi)容,需要的朋友可以參考借鑒,下面來一起看看吧。2017-03-03
Python3.6筆記之將程序運(yùn)行結(jié)果輸出到文件的方法

