1 / 7

Special effects

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);

tupchurch
Download Presentation

Special effects

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Special effects Jen-Chang Liu, Spring 2005

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

  3. 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;

  4. 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; 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

  5. 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; end; Ex.2: produce ripples in the polar coordinate (to r component)

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

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

More Related