您的位置:首页技术文章
文章详情页

Python实现PS滤镜中的USM锐化效果

【字号: 日期:2022-07-03 10:51:07浏览:5作者:猪猪

本文用 Python 实现 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()

实现效果:

Python实现PS滤镜中的USM锐化效果

以上就是Python实现PS滤镜中的USM锐化效果的详细内容,更多关于python usm锐化的资料请关注好吧啦网其它相关文章!

标签: Python 编程
相关文章: