本文用 Python 实现 PS 滤镜中的表面模糊,具体的算法原理和效果可以参考之前的博客:

http://blog.csdn.net/matrix_space/article/details/52818857

import matplotlib.pyplot as plt
from skimage import io
import numpy as np
import numpy.matlib file_name='D:/Visual Effects/PS Algorithm/1.jpg';
img=io.imread(file_name) def Sur_blur ( I_in, thre, half_size):
I_out = I_in * 1.0
row, col = I_in.shape
w_size = half_size * 2 + 1
for ii in range (half_size, row-1-half_size):
for jj in range (half_size, col-1-half_size):
aa = I_in [ii-half_size:ii+half_size+1, jj-half_size : jj+half_size+1]
p0 = I_in [ii, jj]
mask_1 = numpy.matlib.repmat(p0, w_size, w_size)
mask_2 = 1-abs(aa-mask_1)/(2.5*thre);
mask_3 = mask_2 * (mask_2 > 0)
t1 = aa * mask_3
I_out[ii, jj] = t1.sum()/mask_3.sum() return I_out img_out = img * 1.0
thre = 20
half_size =10
img_out[:, :, 0] = Sur_blur (img[:, :, 0], thre, half_size)
img_out[:, :, 1] = Sur_blur (img[:, :, 1], thre, half_size)
img_out[:, :, 2] = Sur_blur (img[:, :, 2], thre, half_size) img_out = img_out/255 plt.figure(1)
plt.imshow(img)
plt.axis('off') plt.figure(2)
plt.imshow(img_out)
plt.axis('off') plt.show()

Python: PS 滤镜--表面模糊的更多相关文章

  1. Python: PS 滤镜--水波特效

    本文用 Python 实现 PS 滤镜中的 水波特效 import numpy as np from skimage import img_as_float import matplotlib.pyp ...

  2. Python: PS 滤镜--旋涡特效

    本文用Python 实现 PS 滤镜的旋涡特效,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/42215 ...

  3. Python: PS 滤镜--USM 锐化

    本文用 Python 实现 PS 滤镜中的 USM 锐化效果,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/detail ...

  4. Python: PS 滤镜--素描

    本文用 Python 实现 PS 滤镜中的素描特效,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/386 ...

  5. Python: PS 滤镜--旋转模糊

    本文用 Python 实现 PS 滤镜中的旋转模糊,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/392 ...

  6. Python: PS滤镜--径向模糊

    本文用 Python 实现 PS 滤镜中的径向模糊特效,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/3 ...

  7. Python: PS 滤镜--马赛克

    本文利用 Python 实现PS 滤镜中的马赛克效果,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/30 ...

  8. Python: PS 滤镜--高反差保留 (High pass)

    本文用 Python 实现 PS 滤镜中的 高反差保留 特效,具体的算法原理和图像效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/deta ...

  9. Python: PS 滤镜--碎片特效

    本文用 Python 实现 PS 滤镜中的碎片特效,这个特效简单来说就是将图像在 上,下,左,右 四个方向做平移,然后将四个方向的平移的图像叠加起来做平均.具体的效果图可以参考之前的博客 http:/ ...

随机推荐

  1. XmlNode与XmlElement的区别总结

    原文链接:http://www.cnblogs.com/oilsun/archive/2012/07/07/2580427.html 今 天在做ASP.NET操作XML文档的过程中,发现了两个类:Xm ...

  2. [Algorithms] Tree Data Structure in JavaScript

    In a tree, nodes have a single parent node and may have many children nodes. They never have more th ...

  3. PS 如何制作眼泪效果

    1.用钢笔工具勾出眼泪的路径然后按Ctrl + Enter转为选区 2.按Ctrl + J 把选区复制出来,执行滤镜 > 扭曲 > 球面化 同样的方法制作流出的眼泪,然后添加图层样式选择投 ...

  4. nginx list directory

    使用 http autoindex 模块列出 目录, 例如 需要将 /var/www 下的 resourcepacks 目录以 http 的方式 暴露         这样设置 nginx       ...

  5. CSDN - 进程结束后new出的内存会回收吗?

    http://blog.csdn.net/stanjiang2010/article/details/5386647     关键词:内存回收  

  6. enter键触发的函数

    enter键触发的函数示例: <input type="text" onkeydown="fun();"> function fun() { if( ...

  7. DDR 布线规则

    https://blog.csdn.net/cpf099/article/details/52038862 https://blog.csdn.net/cpf099/article/details/5 ...

  8. Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.

    运行/usr/local/webserver/php/bin/phpize时出现: Configuring for: PHP Api Version: 20041225 Zend Module Api ...

  9. LeetCode(70)题解: climbing-stairs

    https://leetcode.com/problems/climbing-stairs/ 题目: You are climbing a stair case. It takes n steps t ...

  10. GCJ Qualification Round 2016 C题

    题意是给定了一个叫“jamcoin”的定义,让你生成足够数量满足条件的jamcoin. jamcoin其实就可以理解成一个二进制整数,题目要求的要么长度为16位,要么为32位,一头一尾两个位必须是1, ...