MATLAB Answers

Restoration: Generating mOtion Blurred Image using the model in Gonzalez Text Book

179 views (last 30 days)
Gopuse
Gopuse on 30 May 2013
Commented: Ajay Negi on 14 Apr 2020
Hi, I am new member to this community. I was trying to simulate motion blur with the model given in Gonzalez 3rd Edition(Eqn 5.6.11) which is H(u,v)=(T/X)sin(X)e^(-jX) where X = pi(ua+vb). Here a, b, T are linear motion defining constants. As explained in the text book(page 372), I was expecting a motion blur in 45 degree direction for the parameters T=1, a=0.1 and b=0.1. But I am not getting it. Following is my code. Can anybody tell me where I went wrong.
im = (imread('DigitImgTB.jpg'));
[m n] = size(im); [u v] = meshgrid(1:m, 1:n);
T = 1; a = 0.1; b = 0.1;
Hmb = (T./(pi*(u*a+v*b))).*(sin(pi*(u*a + v*b))).*(exp(-1j*pi.*(u*a + v*b)));
MB = ifft2(fft2(im).*Hmb);
imshow(log(abs(MB)+1), []);
The input image is available at
http://users.rowan.edu/~shreek/fall09/dip/lab3/GW_Fig5_26.jpg
Thank you, Gopakumar

  0 Comments

Sign in to comment.

Answers (2)


Nha Hoang
Nha Hoang on 29 Oct 2019
Edited: Nha Hoang on 29 Oct 2019
I have a same question too. This is my code, it did not produce blur image as textbook. I really want to know the solution because it has cost me a week already. Thanks in advance!
c = im2double(rgb2gray(imread('book.png')));
cf= fftshift(fft2(c));
a = 0.1;
b = 0.1;
T=1;
[M, N] = size(c);
h = zeros(M, N);
for u = 1:M
for v = 1:N
h(u,v) = (T/(pi*(u*a + v*b)))*...
sin(pi*(u*a + v*b))*...
exp(-1i*pi*(u*a + v*b));
end
end
c1 = cf.*h;
c1a=abs(ifft2(c1));

  0 Comments

Sign in to comment.

Sign in to answer this question.