clc;
clear all;
close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread('4.jpg');
I=double(I);
Image=I/255;
[height, width, depth]=size(Image); wavelength = 20;
amplitude = 10;
phase = 0;
centreX = 0.5;
centreY = 0.5;
radius = 0; if (radius==0)
radius=min(height, width)/2;
end icentreX=width*centreX;
icentreY=height*centreY;
radius2=radius*radius;
Image_new=Image; for ii=1:height
for jj=1:width dx=jj-icentreX;
dy=ii-icentreY; distance2=dx*dx+dy*dy; if (distance2>radius2)
x=jj;
y=ii;
else
distance=sqrt(distance2);
amount=amplitude * sin(distance / wavelength * 2*pi - phase);
amount =amount* (radius-distance)/radius;
amount=amount*wavelength/(distance+0.0001); x =jj + dx*amount;
y = ii + dy*amount; end % % 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);

参考来源:http://www.jhlabs.com/index.html

原图:

效果图:

PS 滤镜— —水波效果的更多相关文章

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

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

  2. PS 滤镜——水波 water wave

    %%%% Water wave %%%% 制作水波效果 clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Process ...

  3. Python: PS 滤镜--水波特效

    本文用 Python 实现 PS 滤镜中的 水波特效 import numpy as np from skimage import img_as_float import matplotlib.pyp ...

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

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

  5. PS 滤镜— —挤压效果

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

  6. PS 滤镜— —Marble 效果

    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. PS 滤镜— — sparkle 效果

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

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

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

随机推荐

  1. Java使用笔记之stream和sorted使用

    //对象类型stream排序List<User> users = new ArrayList<User>(){ { add(new User("a", &q ...

  2. 浅谈Generator和Promise原理及实现

    Generator 熟悉ES6语法的同学们肯定对Generator(生成器)函数不陌生,这是一个化异步为同步的利器. 栗子: function* abc() { let count = 0; whil ...

  3. 结构体定义:struct与typedef struct

    https://blog.csdn.net/haiou0/article/details/6877718?tdsourcetag=s_pcqq_aiomsg https://blog.csdn.net ...

  4. ordinal parameter mismatch

    © 版权声明:本文为博主原创文章,转载请注明出处 错误描述:Caused by: org.hibernate.HibernateException: ordinal parameter mismatc ...

  5. java String概述

    class StringDemo { public static void main(String[] args)  {  String s1 = "abc";//s1 是一个类类 ...

  6. linux uart驱动——uart platfrom 注册(三)

    一:注册platform device 注册一个platfrom device一般需要初始化两个内容,设备占用的资源resource和设备私有数据dev.platfrom_data.设备的resour ...

  7. 玩转 eclipse:[1]如何快速找错-debug

    本文摘自百度经验 原文地址如下: 玩转 eclipse:[1]如何快速找错-debu eclipse是软件开发人员必备的IDE之一. 由于语言障碍或者是经验不足,许多刚刚新手并不清楚如何高效使用ecl ...

  8. 《Programming WPF》翻译 第4章 5.主从复合(Master-Detail)绑定

    我们已经看到绑定一个单独的对象,还看到绑定一个单独的对象列表.另一种非常流行的方式是绑定多个对象列表,尤其是相关的列表.例如,如果你向用户显示一个客户列表,当他们选中其中一个客户,就会显示客户的相关订 ...

  9. php 算法之------------怎样打印出下图

    自己偶尔看到了下图.于是用php打印出下图. watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveGluZ2ppZ29uZ3Np/font/5a6L5L2T/f ...

  10. NDK以及C语言基础语法(二)

    一.字符串类:(属于类类型) -String (在C++中才有) 使用之前必学引入String 类型: 引入String头文件(系统的头文件): #include <string>   p ...