PS 滤镜— — sparkle 效果
clc;
clear all;
close all;
addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm');
I=imread('4.jpg');
Image=double(I)/255;
[height, width, depth]=size(Image);
rays = 25;
radius = 25;
amount = 25; % 1-100
color = [1.0, 1.0, 1.0]; % 0-1
randomness = 25;
centreX=width/2.0;
centreY=height/2.0;
% % seed = 371;
rayLengths=radius+randomness / 100.0 * radius * rand(1,rays);
Img_new=Image;
for ii=1:height
for jj=1:width
dx = jj-centreX;
dy = ii-centreY;
distance=sqrt(dx*dx+dy*dy);
angle = atan2(dy, dx);
d = (angle+pi) / (2*pi) * rays;
f=d-floor(d);
len_1=rayLengths(mod(floor(d), rays)+1);
len_2=rayLengths(mod(floor(d)+1, rays)+1);
length = lerp(f, len_1, len_2);
g = length*length / (distance+0.0001);
g = g.^((100-amount) / 50.0);
f =f - 0.5;
% % f = 1-f*f;
f =f * cos(g);
% % f =f * sin(g);
f=min(max(0,f),1);
r=Image(ii, jj, 1);
g=Image(ii, jj, 2);
b=Image(ii, jj, 3);
Img_new(ii, jj, 1)=lerp(f, r, color(1));
Img_new(ii, jj, 2)=lerp(f, g, color(2));
Img_new(ii, jj, 3)=lerp(f, b, color(3));
end
end
imshow(Img_new);
imwrite(Img_new, 'out.jpg');
参考来源:http://www.jhlabs.com/index.html
原图:
效果图:
PS 滤镜— — sparkle 效果的更多相关文章
- Python: PS 滤镜--万花筒效果
本文用 Python 实现 PS 的一种滤镜效果,称为万花筒.也是对图像做各种扭曲变换,最后图像呈现的效果就像从万花筒中看到的一样: 图像的效果可以参考之前的博客: http://blog.csdn. ...
- PS 滤镜— —挤压效果
clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...
- PS 滤镜— —Marble 效果
clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...
- PS 滤镜— — 万花筒效果
clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...
- PS 滤镜— —水波效果
clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...
- PS 滤镜— —球面化效果
clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...
- PS滤镜— —波浪效果
clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...
- OpenCV——PS滤镜 水波效果
// define head function #ifndef PS_ALGORITHM_H_INCLUDED #define PS_ALGORITHM_H_INCLUDED #include < ...
- Python: PS 滤镜--旋涡特效
本文用Python 实现 PS 滤镜的旋涡特效,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/42215 ...
随机推荐
- sql查字符串包含某字段查询
select * from dbo.V_AgreementMaterialQuery where '上海市' like '%'+SaleRange+'%' ‘上海市’>SaleRange(上海)
- java程序如何优化--技巧总结
http://www.douban.com/group/topic/17850695/
- 楼梯跳跃代码web
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- Enumerate Combination C(k, n) in a bitset
Suppose n<=32, we can enumerate C(k, n), with bits representing absence or presence, in the follo ...
- js 显示当前系统时间
<div id="test"></div> <script > setInt ...
- 目标检测之基础hessian matrix ---海森矩阵
就是海赛(海色)矩阵,在网上搜就有. 在数学中,海色矩阵是一个自变量为向量的实值函数的二阶偏导数组成的方块矩阵, Hessian矩阵是多维变量函数的二阶偏导数矩阵,H(i,j)=d^2(f)/(d(x ...
- POJ 3895 Cycles of Lanes (dfs)
Description Each of the M lanes of the Park of Polytechnic University of Bucharest connects two of t ...
- 【Android开发-5】界面装修,五大布局你选谁
前言:假设要开一家店,门店装修是非常重要的事情.有钱都请专门的建筑设计公司来设计装修,没钱的仅仅能自己瞎折腾.好不好看全凭自己的感觉.像Android开发.在移动端大家看到的界面视觉不咋滴,一般连打开 ...
- bash学习记录
bash: 管理员: 提示符# 普通用户:提示符$ 环境变量 A=3(变量是指内存空间,A指的是内存空间的名称-变量标示符) PS1 \u@\h:\w\$ \u用户名 \h主机名 \w工作目录的 ...
- Python:list、dict、string
<<List>>列表 [python] view plaincopy 创建列表 sample_list = ['a',1,('a','b')] Python 列表操作 samp ...