PS 滤镜— —Marble 效果
2024-08-22 10:09:05
clc;
clear all;
close all;
addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm');
I=imread('4.jpg');
I=double(I);
Image=I/255;
xScale = 20;
yScale = 20;
amount = 1;
turbulence =0.25;
Image_new=Image;
[height, width, depth]=size(Image);
Index=1:256;
sin_T=-yScale*sin(2*pi*(Index-1)/256*turbulence);
cos_T=xScale*cos(2*pi*(Index-1)/256*turbulence);
[ind, g1, g2, g3]=init_arr();
for ii=1:height
% % [ind, g1, g2, g3]=init_arr();
for jj=1:width
dis=min(max( floor(127*(1+Noise2(jj/xScale, ii/yScale, ind, g2))), 1), 256);
x=jj+sin_T(dis);
y=ii+cos_T(dis);
% % if (x<=1) x=1; end
% % if (x>=width) x=width-1; end;
% % if (y>=height) y=height-1; end;
% % if (y<1) y=1; end;
% %
if (x<=1) continue; end
if (x>=width) continue; end;
if (y>=height) continue; end;
if (y<1) continue; end;
x1=floor(x);
y1=floor(y);
p=x-x1;
q=y-y1;
Image_new(ii,jj,:)=(1-p)*(1-q)*Image(y1,x1,:)+p*(1-q)*Image(y1,x1+1,:)...
+q*(1-p)*Image(y1+1,x1,:)+p*q*Image(y1+1,x1+1,:);
end
end
imshow(Image_new)
imwrite(Image_new, 'out.jpg');
参考来源:http://www.jhlabs.com/index.html
原图:
效果图:
最新文章
- C# System.Threading.Timer 使用方法
- NanoProfiler - 适合生产环境的性能监控类库 之 实践ELK篇
- mysql 判断 字段是否为空
- varchar和Nvarchar区别
- 通过data:image/png;base64把图片直接写在src里
- Spark Streaming和Flume-NG对接实验
- 不小心rm删除文件怎么办
- spring源码学习之:xml标签扩展配置例子
- 函数buf_page_init_for_read
- MySQL锁系列2 表锁
- Elasticsearch强大的聚合功能Facet
- 分享你最喜欢的技巧和提示(Xcode,Objective-C,Swift,C...等等)
- BOM(1)
- APP崩溃提示:This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.
- JQuery ajax的使用
- # 【Python3练习题 007】 有一对兔子,从出生后第3个月起每个月都生一对兔子, # 小兔子长到第三个月后每个月又生一对兔子, # 假如兔子都不死,问每个月的兔子总数为多少?
- 本文转自 MyEclipse 2015反编译插件安装
- Aizu0189 Convenient Location(多源最短路)
- Python入门之安装numpy和pandas
- 【洛谷】【动态规划(二维)】P1508 Likecloud-吃、吃、吃
热门文章
- 转载 【iOS开发】网页JS与OC交互(JavaScriptCore) OC ----->;JS
- ios输出想保留的整数位(占位符)
- 【BZOJ3698】XWW的难题 有上下界的最大流
- visual studio code (vscode)像 sublime text 的 ctrl+d 一样多光标选中
- thinkphp5, 省略index.php
- CSS 布局实例系列(二)如何通过 CSS 实现一个左边固定宽度、右边自适应的两列布局
- Android笔记之获取debug.keystore和release.keystore的MD5/SHA1值
- 9.Django里的数据同步migrations命令
- python2 生成验证码图片
- java获取调用此方法的上面的方法名、类