PS 滤镜— —水波效果
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 滤镜— —水波效果的更多相关文章
- OpenCV——PS滤镜 水波效果
// define head function #ifndef PS_ALGORITHM_H_INCLUDED #define PS_ALGORITHM_H_INCLUDED #include < ...
- PS 滤镜——水波 water wave
%%%% Water wave %%%% 制作水波效果 clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Process ...
- Python: PS 滤镜--水波特效
本文用 Python 实现 PS 滤镜中的 水波特效 import numpy as np from skimage import img_as_float import matplotlib.pyp ...
- 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 滤镜— — 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 ...
随机推荐
- DisplayPort的时钟隐藏和时钟恢复
转:DisplayPort的时钟隐藏和时钟恢复 无时钟线的视频数据传输是DP协议的一大特点,将时钟信号隐藏在数据中是传输协议的设计趋势.时钟恢复技术也是DP芯片设计的关键技术.在这说一下在发送端时钟是 ...
- php设计模式中的类型安全 指--只接受特定的对象 ---以避免发生错误
在百度百科中---类型安全代码指访问被授权可以访问的内存位置
- python学习(七)字典学习
#!/usr/bin/python # 字典 # 当时学java的时候, 语言基础就学了好久, 然后是各种API, 最后才是集合 # 键值对, 可变 # 1. 映射操作 D = {'food' : ' ...
- 目标检测之行人检测(Pedestrian Detection)---行人检测之简介0
一.论文 综述类的文章 [1]P.Dollar, C. Wojek,B. Schiele, et al. Pedestrian detection: an evaluation of the stat ...
- 32.10 使用模板更改控件的UI
32.10 使用模板更改控件的UI 样式是改变WPF控件基本外形的非常好(且非常简单)的方式,它通过为窗口部件的特性设置建立一组默认的值,从而改变WPF控件的基本外形.但是,即使样式允许我们改变各种 ...
- 漫反射和Lambert模型
粗糙的物体表面向各个方向等强度地反射光,这种等同地向各个方向散射的现象称为光的漫反射(diffuse reflection).产生光的漫反射现象的物体表面称为理想漫反射体,也称为朗伯(Lambert) ...
- react build和server start
先到项目目录build项目 npm run build 项目会打包到dist文件夹下 index.html和index.js等 react的项目build后不能直接访问的问题 先执行 npm inst ...
- ICMP控制报文协议
1.引言 ICMP经常被认为是IP层的一个组成部分.它传递差错以及其他需要注意的信息.ICMP报文通常被IP层或更高层 协议(TCP或UDP)使用.一些ICMP报文把差错报文返回给用户进程.ICMP报 ...
- Magnetic Fingerprinting Approach to Indoor Localization
Magnetic Fingerprinting Approach to Indoor Localization
- 关于jquery-weui.js中时间控件datetimepicker的使用
今天第一次接触jquery-weui,不太了解用法,然而官方文档写的也很简略,只好打开源代码进行研究,我想要的是设置开始日期大于当前日期,然后在源码中发现有min这个默认为undefined的属性,于 ...