摘要:本文主要向大家介绍了Photoshop入门学习之PS 滤镜——径向模糊,通过具体的内容向大家展现,希望对大家Photoshop入门学习有所帮助。
本文主要向大家介绍了Photoshop入门学习之PS 滤镜——径向模糊,通过具体的内容向大家展现,希望对大家Photoshop入门学习有所帮助。
这里给出灰度图像的模糊算法,彩色图像只要分别对三个通道做模糊即可。
%%% radiation blur
%%%
clc;
clear all;
close all;
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);
Image_new(1:row,1:col)=255;
Center_X=(col+1)/2;
Center_Y=(row+1)/2;
alpha=0.85;
for i=1:floor(Center_Y)
for j=floor(Center_X)+1:col
% 第一象限
x1=j-Center_X;
y1=Center_Y-i;
T1=Image(i,j);
% 第三象限
x3=-x1;
y3=-y1;
x_image=floor(Center_X+x3);
y_image=floor(Center_Y-y3);
i3=y_image;
j3=x_image;
T3=Image(y_image,x_image);
% 第二象限
x2=-x1;
y2=y1;
x_image=floor(Center_X+x2);
y_image=floor(Center_Y-y2);
i2=y_image;
j2=x_image;
T2=Image(y_image,x_image);
%第四象限
x4=x1;
y4=-y1;
x_image=floor(Center_X+x4);
y_image=floor(Center_Y-y4);
i4=y_image;
j4=x_image;
T4=Image(y_image,x_image);
k=y1/x1;
x_start=x1*alpha;
y_start=k*x_start;
x_end=x1;
y_end=y1;
x=x_start;
y=y_start;
if(x1>y1)
Num_Pixel=floor(x_end-x_start)+1;
for x=x_start:x_end-1
y0=k*(x+1);
% 第一象限
x1=x+1;
y1=round(y0);
% y=y+1;
x_image=floor(Center_X+x1);
y_image=floor(Center_Y-y1);
T1=T1+Image(y_image,x_image);
% 第三象限
x3=-x1;
y3=-y1;
x_image=floor(Center_X+x3);
y_image=floor(Center_Y-y3);
T3=T3+Image(y_image,x_image);
% 第二象限
x2=-x1;
y2=y1;
x_image=floor(Center_X+x2);
y_image=floor(Center_Y-y2);
T2=T2+Image(y_image,x_image);
% 第四象限
x4=x1;
y4=-y1;
x_image=floor(Center_X+x4);
y_image=floor(Center_Y-y4);
T4=T4+Image(y_image,x_image);
end
else
Num_Pixel=floor(y_end-y_start)+1;
for y=y_start:y_end-1
x0=(y+1)/k;
% 第一象限
x1=floor(x0);
y1=y+1;
x_image=floor(Center_X+x1);
y_image=floor(Center_Y-y1);
T1=T1+Image(y_image,x_image);
% 第三象限
x3=-x1;
y3=-y1;
x_image=floor(Center_X+x3);
y_image=floor(Center_Y-y3);
T3=T3+Image(y_image,x_image);
% 第二象限
x2=-x1;
y2=y1;
x_image=floor(Center_X+x2);
y_image=floor(Center_Y-y2);
T2=T2+Image(y_image,x_image);
% 第四象限
x4=x1;
y4=-y1;
x_image=floor(Center_X+x4);
y_image=floor(Center_Y-y4);
T4=T4+Image(y_image,x_image);
end
end
Image_new(i,j)=T1/Num_Pixel;
Image_new(i2,j2)=T2/Num_Pixel;
Image_new(i3,j3)=T3/Num_Pixel;
Image_new(i4,j4)=T4/Num_Pixel;
end
end
imshow(Image_new/255);
本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注常用软件Photoshop频道!
您输入的评论内容中包含违禁敏感词
我知道了
请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号