I want to compute blur kernel of image using radon transform, but i am not getting correct result. is my code correct?
Show older comments
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 Comment
Image Analyst
on 23 Jul 2015
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.
Answers (0)
Categories
Find more on Image Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!