Python: PS 滤镜--旋转模糊
本文用 Python 实现 PS 滤镜中的旋转模糊,具体的算法原理和效果可以参考之前的博客:
http://blog.csdn.net/matrix_space/article/details/39211667
from skimage import img_as_float
import matplotlib.pyplot as plt
from skimage import io
import numpy as np
import numpy.matlib
file_name='D:/Visual Effects/PS Algorithm/4.jpg'
img=io.imread(file_name)
img = img_as_float(img)
img_out = img.copy()
row, col, channel = img.shape
xx = np.arange (col)
yy = np.arange (row)
x_mask = numpy.matlib.repmat (xx, row, 1)
y_mask = numpy.matlib.repmat (yy, col, 1)
y_mask = np.transpose(y_mask)
center_y = (row -1) / 2.0
center_x = (col -1) / 2.0
R = np.sqrt((x_mask - center_x) **2 + (y_mask - center_y) ** 2)
angle = np.arctan2(y_mask - center_y , x_mask - center_x)
Num = 20
arr = ( np.arange(Num) + 1 ) / 100.0
for i in range (row):
for j in range (col):
T_angle = angle[i, j] + arr
new_x = R[i, j] * np.cos(T_angle) + center_x
new_y = R[i, j] * np.sin(T_angle) + center_y
int_x = new_x.astype(int)
int_y = new_y.astype(int)
int_x[int_x > col-1] = col - 1
int_x[int_x < 0] = 0
int_y[int_y < 0] = 0
int_y[int_y > row -1] = row -1
img_out[i,j,0] = img[int_y, int_x, 0].sum()/Num
img_out[i,j,1] = img[int_y, int_x, 1].sum()/Num
img_out[i,j,2] = img[int_y, int_x, 2].sum()/Num
plt.figure(1)
plt.imshow(img)
plt.axis('off')
plt.figure(2)
plt.imshow(img_out)
plt.axis('off')
plt.show()
Python: PS 滤镜--旋转模糊的更多相关文章
- PS 滤镜——旋转模糊
这里给出灰度图像的模糊算法,彩色图像只要分别对三个通道做模糊即可. %% spin blur % 旋转模糊 clc; clear all; close all; I=imread('4.jpg'); ...
- Python: PS 滤镜--水波特效
本文用 Python 实现 PS 滤镜中的 水波特效 import numpy as np from skimage import img_as_float import matplotlib.pyp ...
- Python: PS 滤镜--旋涡特效
本文用Python 实现 PS 滤镜的旋涡特效,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/42215 ...
- Python: PS 滤镜--USM 锐化
本文用 Python 实现 PS 滤镜中的 USM 锐化效果,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/detail ...
- Python: PS 滤镜--素描
本文用 Python 实现 PS 滤镜中的素描特效,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/386 ...
- Python: PS 滤镜--表面模糊
本文用 Python 实现 PS 滤镜中的表面模糊,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/528 ...
- Python: PS滤镜--径向模糊
本文用 Python 实现 PS 滤镜中的径向模糊特效,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/3 ...
- Python: PS 滤镜--马赛克
本文利用 Python 实现PS 滤镜中的马赛克效果,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/30 ...
- Python: PS 滤镜--高反差保留 (High pass)
本文用 Python 实现 PS 滤镜中的 高反差保留 特效,具体的算法原理和图像效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/deta ...
随机推荐
- SilverLight-DataControls:四、The PagedCollectionView(分页的集合视图) 对象
ylbtech-SilverLight-DataControls-PagedCollectionView:The PagedCollectionView(分页的集合视图) 对象 1.A, Buildi ...
- 如何去掉Google搜索的跳转 让你的Google搜索不被reset掉
http://www.nowamagic.net/librarys/veda/detail/389 在点击google搜索结果时,google会在结果的URL前做个跳转,且有时这个跳转地址会被墙,这样 ...
- Allegro布线基本操作
转:allegro基本步骤 常见问题 cadence16.5中电源线.地线取消飞线显示 目录: 一.Allegro基本技巧 1.关闭电源和地网络的飞线 2.开启特定NET飞线 3.元器件快速对齐(待完 ...
- Qt在线讲座之QML脚本书写规范
时间:2016年3月1日晚7:30 在线讲座:http://qtdream.com主页处就可以收看直播(详见主页提示) 參与对象:对Qt跨平台开发框架感兴趣的朋友们.当然了,假设你是大牛.也可以旁听一 ...
- python-tornado操作
Tornado 是 FriendFeed 使用的可扩展的非阻塞式 web 服务器及其相关工具的开源版本.这个 Web 框架看起来有些像web.py 或者 Google 的 webapp,不过为了能有效 ...
- 02 php生成xml数据
<?php class Response_xml{ /** *按xml方式输出通信 *@param integet $code 状态码 *@param string $message 提示信息 ...
- 搭建React Native开发环境
搭建React Native开发环境 本文档是Mac下搭建的环境,针对的目标平台不同,以及开发 iOS 和 Android 的不同,环境搭建也有差异. Github地址:https://github. ...
- PowerDesigner逆向工程,从SQL Server数据库生成Physical Model -----数据源方式
1.File-Reverse Engineer-Database 2.DBMS选择SQL Server 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 一路Next..... ...
- WinCE下使用C#的几个小技巧
1.我们知道,在使用Windows的开发机上用C#启动一个外部程序的方法有很多,但这些方法用在使用WinCE的目标工控机上都无能为力,现在小嫚儿以打开一个IE为例,介绍如何在WinCE下使用C#来打开 ...
- bjfu1332 简单动规
挺简单的动态规划题.我用记忆化搜索打的.直接上代码: /* * Author : ben */ #include <cstdio> #include <cstdlib> #in ...