I want to compute blur kernel of image using radon transform, but i am not getting correct result. is my code correct?
2 次查看(过去 30 天)
显示 更早的评论
divides image in to overlapping blocks I=imread('runman.jpg'); I=rgb2gray(I);
%function computes blur extent
fun2=@BlurEstimation;
fun3=@BlurEstimationMag;
dir=blkproc(I,[20 20],[2 2],fun2)%process overlapping block mag=blkproc(I,[20 20],[10 10],fun3)%process overlapping block
figure;quiver(dir,dir);
function [theta] = BlurEstimation(h) len=5; %length of kernel n=60; %noise p=1/len*[1 1 1 1 1]; % blurring kernel for linear motion
%..........for directional motion rotate p by %theta
i1=imfilter(h,p,'conv')+n; %....(1)
di=diff(i1); %differentiating (1)
i1=log(fft2(di)); %fourier transform of (1).
theta = 0:180; [r,xp] = radon(i1,theta); %radon transform of i1
r=fft2(r); %fourier transform of radon transform
% Find the location of the peak of the radon transform image. maxR= max(r(:)); [row col]=find(r==maxR); theta=90-radtodeg(angle(maxR)); % minR=min(r(:)) % thetamin=radtodeg(angle(minR)) theta=90-col end
1 个评论
Image Analyst
2015-7-23
In the MATLAB editor, type control-a then control-i to properly indent your code. Then type control-c to copy it to the clipboard, then paste it here. Then highlight it and click {}Code. Then we'll be able to read it.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!