需要按一定规律扭曲后图片,以下为整理的两种方法。
原图:
- 波纹扭曲
扭曲结果:
clear all;close all;clc;
img=imread('lena.jpg');
[h w]=size(img);
wave=[10,100]; %[幅度,周期]
newh=h+2*wave(1);
neww=w+2*wave(1);
rot=0;
for i=1:10
imgn=zeros(newh,neww);
rot=rot+0.2;
for y=1:newh
for x=1:neww
yy=round((y-wave(1))-(wave(1)*cos(2*pi/wave(2)*x+rot))); %依然是逆变换
xx=