Clc;clear all;close all;addpath (' E:\PhotoShop algortihm\image processing\ps algorithm '); I=imread (' 4.jpg '); I=double ( I); Image=i/255;xscale = 20;yscale = 20;amount = 1;turbulence =0.25;image_new=image; [Height, width, depth]=size (Image); Index=1:256;sin_t=-yscale*sin (2*pi* (Index-1)/256*turbulence); Cos_t=xscale*cos (2*pi* (Index-1)/256*turbulence); [Ind, G1, G2, G3]=init_arr (); for ii=1:height%% [IND, G1, G2, G3]=init_arr (); For Jj=1:width Dis=min (Max (127* (1+noise2 (Jj/xscale, Ii/yscale, Ind, G2)), 1), 256); x=jj+sin_t (DIS); y=ii+cos_t (dis);% 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 ,:); Endendimshow (image_new) imwrite (image_new, ' out.jpg ');
Reference Source: http://www.jhlabs.com/index.html
Original:
:
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
PS Filter--marble Effect