Python實(shí)現(xiàn)PS濾鏡中的USM銳化效果
本文用 Python 實(shí)現(xiàn) PS 濾鏡中的 USM 銳化效果
import matplotlib.pyplot as pltfrom skimage import iofrom skimage.filters import gaussianfile_name=’D:/Visual Effects/PS Algorithm/4.jpg’;img=io.imread(file_name)img = img * 1.0gauss_out = gaussian(img, sigma=5, multichannel=True)# alpha 0 - 5alpha = 1.5img_out = (img - gauss_out) * alpha + imgimg_out = img_out/255.0# 飽和處理mask_1 = img_out < 0 mask_2 = img_out > 1img_out = img_out * (1-mask_1)img_out = img_out * (1-mask_2) + mask_2plt.figure()plt.imshow(img/255.0)plt.axis(’off’)plt.figure(2)plt.imshow(img_out)plt.axis(’off’)plt.show()
實(shí)現(xiàn)效果:
以上就是Python實(shí)現(xiàn)PS濾鏡中的USM銳化效果的詳細(xì)內(nèi)容,更多關(guān)于python usm銳化的資料請關(guān)注好吧啦網(wǎng)其它相關(guān)文章!
相關(guān)文章:
1. ASP編碼必備的8條原則2. 使用css實(shí)現(xiàn)全兼容tooltip提示框3. 一文帶你搞懂JavaScript中的進(jìn)制與進(jìn)制轉(zhuǎn)換4. 匹配模式 - XSL教程 - 45. 詳解JS前端使用迭代器和生成器原理及示例6. 得到XML文檔大小的方法7. 詳解CSS偽元素的妙用單標(biāo)簽之美8. ASP刪除img標(biāo)簽的style屬性只保留src的正則函數(shù)9. 怎樣才能用js生成xmldom對象,并且在firefox中也實(shí)現(xiàn)xml數(shù)據(jù)島?10. ASP基礎(chǔ)知識Command對象講解
