PS滤镜— —波浪效果
clc;
clear all;
close all;
addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm');
I=imread('4.jpg');
I=double(I);
Image=I/255;
xAmplitude = 25.0;
yAmplitude = 25.0;
xWavelength =32.0
yWavelength = 32.0;
SINE=1;
SAWTOOTH=2;
TRIANGLE=3;
NOISE=4;
[height, width, depth]=size(Image);
Image_new=Image;
wavetype=1;
[ind, g1, g2, g3]=init_arr();
for ii=1:height
for jj=1:width
nx = ii / xWavelength;
ny = jj / yWavelength;
switch wavetype
case 1
fx=sin(nx);
fy=sin(ny);
case 2
fx=mod(nx, 1);
fy=mod(ny, 1);
case 3
fx=triangle(nx);
fy=triangle(ny);
case 4
fx=Noise1(nx, ind, g1);
fy=Noise1(ny, ind, g1);
end
x=jj+xAmplitude * fx;
y=ii+yAmplitude * fy;
% % 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
原图:
效果图:
PS滤镜— —波浪效果的更多相关文章
- Python: PS 滤镜--波浪特效
本文用 Python 实现 PS 滤镜的波浪特效,具体效果可以参考之前的博客 http://blog.csdn.net/matrix_space/article/details/42215221 im ...
- PS 滤镜——波浪 wave
%%% Wave %%% 波浪效果 clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Alg ...
- 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 滤镜— — sparkle 效果
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 ...
随机推荐
- CISCO Configuration Examples and TechNotes
from: http://www.cisco.com/c/en/us/tech/ip/ip-routing/tech-configuration-examples-list.html Border ...
- ArrayList中contains,remove方法返回为false的原因
这几天做一个项目时,遇到ArrayList.remove(Object)方法失败,而ArrayList"包含"删除的对象,这其中的"包含"不是完全包含,请看下面 ...
- JavaScript系列问题
JavaScript系列问题: 0.javascript 基础教程[温故而知新一] 1.通过JS变更页面字体的大小 2.图片压缩优化能有效提高网站浏览速度
- MySQL技术内幕InnoDB存储引擎(表&索引算法和锁)
表 4.1.innodb存储引擎表类型 innodb表类似oracle的IOT表(索引聚集表-indexorganized table),在innodb表中每张表都会有一个主键,如果在创建表时没有显示 ...
- Android使用ViewPager实现无限循环滑动及轮播(附源代码)
MainActivity例如以下: package cc.ww; import java.util.ArrayList; import android.app.Activity; import and ...
- 引用变量的类型强转以及InstanceOf方法的使用
引用到的类: class Person{ String name; } class Student extends Person{ String sut_no; } class ClassMate e ...
- HttpClient 访问 https 出现peer can't
package util; import java.security.cert.CertificateException; import javax.net.ssl.SSLContext;import ...
- 用CMakeLists.txt组织工程
1 一个工程会有多个CMakeLists.txt,如何组织这些CMakeLists.txt来构建一个工程? 1.1 最外层一个CMakeLists.txt,是总的CMakeList.txt,在这个里 ...
- Go 语言中的数组是一种 值类型(不像 C/C++ 中是指向首元素的指针)
the-way-to-go_ZH_CN/07.1.md at master · Unknwon/the-way-to-go_ZH_CN https://github.com/Unknwon/the-w ...
- 为什么Java中的字符串是不可变的?
原文链接:https://www.programcreek.com/2013/04/why-string-is-immutable-in-java/ java字符串是不可变的.不可变类只是一个不能修改 ...