首页 技术 正文
技术 2022年11月14日
0 收藏 939 点赞 4,364 浏览 960 个字
    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

原图:

效果图:

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,105
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,582
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,429
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,200
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,836
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,919