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 效果的更多相关文章

  1. Python: PS 滤镜--万花筒效果

    本文用 Python 实现 PS 的一种滤镜效果,称为万花筒.也是对图像做各种扭曲变换,最后图像呈现的效果就像从万花筒中看到的一样: 图像的效果可以参考之前的博客: http://blog.csdn. ...

  2. PS 滤镜— —挤压效果

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  3. PS 滤镜— —Marble 效果

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  4. PS 滤镜— — 万花筒效果

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  5. PS 滤镜— —水波效果

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  6. PS 滤镜— —球面化效果

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  7. PS滤镜— —波浪效果

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  8. OpenCV——PS滤镜 水波效果

    // define head function #ifndef PS_ALGORITHM_H_INCLUDED #define PS_ALGORITHM_H_INCLUDED #include < ...

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

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

随机推荐

  1. iOS UITableViewDelegate && UITableViewDataSource 执行顺序

    #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableV ...

  2. 转:PCIe基础知识

    PCIe基础知识   版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/zqixiao_09/article/details/51842542 PCIe ...

  3. 数据挖掘之Slope One

    计算偏差: card() 表示集合包含的元素数量. http://www.cnblogs.com/similarface/p/5385176.html 论文地址:http://lemire.me/fr ...

  4. CocoaPods Podfile详解与使用

    1.为什么需要CocoaPods 在进行iOS开发的时候,总免不了使用第三方的开源库,比如SBJson.AFNetworking.Reachability等等.使用这些库的时候通常需要: 下载开源库的 ...

  5. Nginx 经验小结

    chmod 777 永远不要 使用 777,有时候可以懒惰的解决权限问题, 但是它同样也表示你没有线索去解决权限问题,你只是在碰运气. 你应该检查整个路径的权限,并思考发生了什么事情. 把 root ...

  6. java jdbc 同时操作查询删除操作

    Connection conn = null;        try {            // 创建连接实例            conn = JdbcUtility.GetFactory() ...

  7. EasyNVR无插件播放HLS/RTMP网页直播方案前端完善:监听表单变动

    在上一篇博客中我们表述完了防止提交成功后多余操作提交的一个过程:其中的精髓在于ajax的触发事件的使用. 而这篇博客主要想说明一下如何实时的判断出表单是否发生变化. 问题表述: 在网页前端的开发过程中 ...

  8. 校验时间冲突SQL写法

    校验时间是否有冲突,时间是就是看两个时间断是否有交集(写法有两种): a.SELECT * FROM xxx WHERE (startTime > a AND startTime < b) ...

  9. c++ get the pointer from the reference

    int x = 5; int& y = x; int* xp = &x; int* yp = &y; xp is equal to yp. 也就是说,直接对reference取 ...

  10. iOS10.3 UILable中划线失效问题

    iOS10.3系统的一个Bug,在UILable中含有中文时,中划线会失效 NSString *priceStr = [NSString stringWithFormat:@"%.2f元&q ...