溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Python圖像處理模塊ndimage用法實例分析

發布時間:2020-10-13 11:30:18 來源:腳本之家 閱讀:151 作者:cakincqm 欄目:開發技術

本文實例講述了Python圖像處理模塊ndimage用法。分享給大家供大家參考,具體如下:

一 原始圖像

1 代碼

from scipy import misc
from scipy import ndimage
import matplotlib.pyplot as plt
face = misc.face()#face是測試圖像之一
plt.figure()#創建圖形
plt.imshow(face)#繪制測試圖像
plt.show()#原始圖像

2 運行結果

Python圖像處理模塊ndimage用法實例分析

二 高斯濾波

1 代碼

from scipy import misc
from scipy import ndimage
import matplotlib.pyplot as plt
face = misc.face()#face是測試圖像之一
plt.figure()#創建圖形
blurred_face = ndimage.gaussian_filter(face, sigma=7)#高斯濾波
plt.imshow(blurred_face)
plt.show()

2 運行結果

Python圖像處理模塊ndimage用法實例分析

三 邊緣銳化處理

1 代碼

from scipy import misc
from scipy import ndimage
import matplotlib.pyplot as plt
face = misc.face()#face是測試圖像之一
plt.figure()#創建圖形
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 運行結果

Python圖像處理模塊ndimage用法實例分析

四 中值濾波

1 代碼

from scipy import misc
from scipy import ndimage
import matplotlib.pyplot as plt
face = misc.face()#face是測試圖像之一
plt.figure()#創建圖形
median_face = ndimage.median_filter(face,7)#中值濾波
plt.imshow(median_face)
plt.show()

2 運行結果

Python圖像處理模塊ndimage用法實例分析

更多關于Python相關內容可查看本站專題:《Python圖片操作技巧總結》、《Python數據結構與算法教程》、《Python函數使用技巧總結》、《Python字符串操作技巧匯總》及《Python入門與進階經典教程》

希望本文所述對大家Python程序設計有所幫助。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女