I want to compute blur kernel of image using radon transform, but i am not getting correct result. is my code correct?

1 次查看(过去 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

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by