%%% moir%%% moire clc;clear all;close all;addpath (' E:\PhotoShop algortihm\image processing\ps algorithm '); I=imread (' 4. JPG '); i=double (i); image=i;% image=0.2989 * I (:,:, 1) + 0.5870 * I (:,:, 2) + 0.1140 * I (:,:, 3); [Row, Col]=size (Image); R=floor (max (row, col)/2); image_new=image;degree=20; center_x= (col+1)/2; Center_y= (row+1)/2;for i=1:row for J=1:col x0=j-center_x; Y0=center_y-i; if (x0~=0) Beta=atan (y0/x0); if (x0<0) Beta=beta+pi; End Else BETA=PI/2; End Radius=sqrt (x0*x0+y0*y0); Beta=beta+radius*degree; X=radius*sin (Beta); Y=radius*cos (beta);%% x=x+col/2;%% Y=row/2-y; if (x>1 && x<col && y<row && y>1) X1=floor (x); Y1=floor (y); p=x-x1; Q=y-y1; Image_new (i,j) = (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 Endendfigure, Imshow (image_new/255);
Original
Image effects--moire Moir