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銳化的資料請(qǐng)關(guān)注好吧啦網(wǎng)其它相關(guān)文章!
相關(guān)文章:
1. PHP擴(kuò)展之APC——Alternative PHP Cache(可選PHP緩存)2. IntelliJ IDEA 2019.3激活破解的詳細(xì)方法(親測(cè)有效,可激活至 2089 年)3. android RecycleView實(shí)現(xiàn)多級(jí)樹形列表4. 如何使用ASP.NET Core 配置文件5. 如何利用Python matplotlib繪制雷達(dá)圖6. Xpath語(yǔ)法格式總結(jié)7. Python 實(shí)現(xiàn)國(guó)產(chǎn)SM3加密算法的示例代碼8. Ajax報(bào)錯(cuò)400的參考解決辦法9. 如何真正的了解python裝飾器10. 使用Python pip怎么升級(jí)pip
