user2639830
user2639830

Reputation:

Deblurring an image through matrix operations in MATLAB

I want to de-blur an image. The image is 1100x1100 and the colormap is 256x3. To blur an image, one would perform matrix multiplication according to the following equation: Y = XH', where X is the original image. To de-blur the image, one would do X = Y/H'. Hence, I ran the following code.

L = 1100; 
N = 850;
c = [ones(1,N)/N zeros(1,L-N)];
r = [1/N zeros(1,L-1)];
H = toeplitz(c,r);
pic1 = pic/H'; //pic is defined as the original image: 1100 x 1100
image(dePic);

However, when I run this code, I just get a heat map and not the original image. Where am I going wrong? Am I doing the math incorrectly in MATLAB? N=850 is the optimal value for N. This I have confirmed. But just for sanity check, I tried altering N and didn't have much luck.

I also tried the following code. But it just converted the heat map to black and white and didn't have much affect.

L = 1100;
N = 850;
c = [ones(1,N)/N zeros(1,L-N)];
r = [1/N zeros(1,L-1)];
H = toeplitz(c,r);
pic1 = pic/H';
colormap(map); //map is 256x3
image(dePic);
axis image;

Upvotes: 1

Views: 376

Answers (1)

user2639830
user2639830

Reputation:

I am a complete fool. when I call image(), I'm passing in the wrong argument. Here's the updated code that works beautifully.

L = 1100;
N = 850;
c = [ones(1,N) zeros(1,L-N)];
r = [1 zeros(1,L-1)];
H = toeplitz(c,r);
H = H/N;
pic1 = pic*inv(H');
colormap(map);
image(pic1);
axis image;

This works.

Upvotes: 1

Related Questions