Presentation is loading. Please wait.

# Special effects Jen-Chang Liu, Spring 2005.

## Presentation on theme: "Special effects Jen-Chang Liu, Spring 2005."— Presentation transcript:

Special effects Jen-Chang Liu, Spring 2005

Polar coordinates 極座標 r θ x y (x, y) y x Origin:

MATLAB implementation
Cartesian coordinate -> polar coordinate polar coordinate -> Cartesian coordinate rows=256; cols=256; ox=ceil((rows+1)/2); oy=ceil((cols+1)/2); [y,x]=meshgrid([1:cols]-oy, [1:rows]-ox); r=sqrt(x.^2+y.^2); theta=atan2(y,x); x2=round(r.*cos(theta))+ox; y2=round(r.*sin(theta))+oy;

Pixelation effects 像素化
mod operation Radial pixelation % to Cartesian coordinate xx=round(x2)+ox; xx(find(xx>rows))=rows; xx(find(xx<1))=1; yy=round(y2)+oy; yy(find(yy>cols))=cols; yy(find(yy<1))=1; for i=1:rows for j=1:cols f2(i,j)=fg(xx(i,j), yy(i,j)); end; x=1:12 mod(x,4) x-mod(x,4) f=imread(‘flower.tif’); fg=rgb2gray(f); [rows cols]=size(fg); % polar coordinate r2=r-mod(r, 5); theta2=theta-mod(theta, 0.087); Ex.1: Try other mod parameters

Ripple effects Produce repeat patterns
Ripples in the Cartesian coordinate x=1:12 x+mod(x,4) [y,x]=meshgrid(1:cols,1:rows); y2=y+mod(y,32); y2(find(y2<1))=1; y2(find(y2>cols))=cols; for i=1:rows for j=1:cols ripples(i,j)=fg(x(i,j), y2(i,j)); end; Ex.2: produce ripples in the polar coordinate (to r component)

Eyefish effects In the polar coordinate R=max(r(:)); r=r.^2/R;
Ex. 3: Produce the eyefish effect

Other effects Twirl Θ’(i,j) =θ(i,j)+r(i,j)/K
Ex. 4: Produce the Twirl effect with K=100

Download ppt "Special effects Jen-Chang Liu, Spring 2005."

Similar presentations

Ads by Google