基本信息
源码名称:去直线运动模糊
源码大小:1.09KB
文件格式:.m
开发语言:MATLAB
更新时间:2021-11-16
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
本代码主要针对去匀速直线运动模糊
I=imread('cameraman.tif');
I=im2double(I);
psf = fspecial('motion',20,45);%45度移动20像素
blurred = imfilter(I, psf, 'circular', 'conv');%创建模糊图片
imshow(blurred);
F=fft2(blurred);
F=fftshift(F);
F=abs(F);
F=log(F 1);%傅里叶图像
F=mapminmax(F,0,1);
F = im2uint8(F);
F=medfilt2(F,[3,3]);
thresh = graythresh(F); %自动确定二值化阈值
B = im2bw(F,thresh); %对图像二值化
figure(),imshow(B);
theta= 0:179;
[R,xp]=radon(B,theta);
figure,imagesc(theta,xp,R);
title('R_theta X');
xlabel('theta(degree)'); ylabel('X\prime');
colormap(hot); colorbar;
col_max=max(R);%求每列最大值
[temp,re_theta]=max(col_max);%最大值和角度
[x,y]=size(R);
col_re_theta=R(:,re_theta);
figure();plot(1:1:x,col_re_theta);
[temp,total_max_x]=max(col_re_theta);
for i=total_max_x:x-1
if col_re_theta(i)<col_re_theta(i 1)
break;
end
end
D=i-total_max_x;
[x,y]=size(I);
t=x/y;
L= x/D*sqrt(power(sin(re_theta),2) power(t*cos(re_theta),2));
re_psf = fspecial('motion', L, re_theta);
wnr2 = deconvwnr(blurred , re_psf, 0.001);
figure, imshow(wnr2);
本代码主要针对去匀速直线运动模糊
I=imread('cameraman.tif');
I=im2double(I);
psf = fspecial('motion',20,45);%45度移动20像素
blurred = imfilter(I, psf, 'circular', 'conv');%创建模糊图片
imshow(blurred);
F=fft2(blurred);
F=fftshift(F);
F=abs(F);
F=log(F 1);%傅里叶图像
F=mapminmax(F,0,1);
F = im2uint8(F);
F=medfilt2(F,[3,3]);
thresh = graythresh(F); %自动确定二值化阈值
B = im2bw(F,thresh); %对图像二值化
figure(),imshow(B);
theta= 0:179;
[R,xp]=radon(B,theta);
figure,imagesc(theta,xp,R);
title('R_theta X');
xlabel('theta(degree)'); ylabel('X\prime');
colormap(hot); colorbar;
col_max=max(R);%求每列最大值
[temp,re_theta]=max(col_max);%最大值和角度
[x,y]=size(R);
col_re_theta=R(:,re_theta);
figure();plot(1:1:x,col_re_theta);
[temp,total_max_x]=max(col_re_theta);
for i=total_max_x:x-1
if col_re_theta(i)<col_re_theta(i 1)
break;
end
end
D=i-total_max_x;
[x,y]=size(I);
t=x/y;
L= x/D*sqrt(power(sin(re_theta),2) power(t*cos(re_theta),2));
re_psf = fspecial('motion', L, re_theta);
wnr2 = deconvwnr(blurred , re_psf, 0.001);
figure, imshow(wnr2);