图像特效——摩尔纹 moir
生活随笔
收集整理的這篇文章主要介紹了
图像特效——摩尔纹 moir
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
%%% Moir
%%% 摩爾紋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:rowfor j=1:colx0=j-Center_X;y0=Center_Y-i;if(x0~=0)beta=atan(y0/x0);if(x0<0)beta=beta+pi;endelsebeta=pi/2;endradius=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);endend
end
figure, imshow(Image_new/255);
原圖
效果圖
總結
以上是生活随笔為你收集整理的图像特效——摩尔纹 moir的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java知识大全积累篇
- 下一篇: 友盟开放日: 通过 App 内社区提高留