1. Read Original Image
1. I=im2double(imread('jein.jpg'));
2. imshow(I);
3. title('Original Image Jein');
This code for read image jein.jpg
2. Using Motion Blur
A. Simulate
4. LEN=21;
5. THETA=11;
6. PSF=fspecial('motion',LEN,THETA);
7. blurred_image_jein=imfilter(I,PSF,'conv','circular');
8. imshow(blurred_image_jein);
9. title('Blurred Image Jein');
This code using : a point spread function (PSF=linear motion 21 pixels (LEN=21) and an angle of 11degree (THETA=11)). Simulate using filter (imfilter)
B. Restore
10. restore1=deconvwnr(blurred_image_jein,PSF,0);
11. imshow(restore1);
12. title('Restore Image jein');
This code using simplest syntax deconvwnr (the blurrred image, Point spread function/PSF, noise power to singal power ration/NSR=0)
Output:
3. Using Blur and Noise
A. Simulate
13. noise_mean=0;
14. noise_var=0.0001;
15. blurred_noisy=imnoise(blurred_image_jein,'gaussian',noise_mean,noise_var);
16. imshow(blurred_noisy);
17. title('Both Blur and Noise');
This code simulate both blur and noise (Gaussian)
Output:
B1. Restore the Blurred Image
18. restore2=deconvwnr(blurred_noisy,PSF,0);
19. imshow(restore2);
20. title(''1st Attempt to restore the blurred and noisy UsingNSR=0');
This code using simplest syntax deconvwnr (the blurrred and noise image, Point spread function/PSF, noise power to singal power ration/NSR=0)
Output:
B2. Restore the Blurred Image
21. signal_var=var(I(:));
22. restore3=deconvwnr(blurred_noisy,PSF,noise_var/signal_var);
23. imshow(restore3);
24. title('2nd Attempt to restore the blurred and noisy using Estimate NSR');
This code using estimate of the noise power to signal power ratio and syntax deconvwnr
Output:
4. Using Blur and 8-Bit Quantization Noise
A. Simulate
25. I=imread('jein.jpg');
26. class(I);
27. blurred_quantity=imfilter(I,PSF,'conv','circular');
28. class(blurred_quantity)
ans =
uint8
B1. Restore the Blurred Image
29. restore4=deconvwnr(blurred_quantity,PSF,0);
30. imshow(restore4);
31. title('Image without double Restore the blurred and noisy Using NSR=0');
This code using syntax deconvwnr (the blurrred and noise image, Point spread function/PSF, noise power to singal power ration/NSR=0)
Output:
B2. Restore the Blurred Image
32. uniform_quantization_var=(1/256)^2/12;
33. signal_var=var(im2double(I(:)));
34. restore5=deconvwnr(blurred_quantity,PSF,uniform_quantization_var/signal_var);
35. imshow(restore5);
36. title('Restoration of blurred, quantized image using computes NSR');
This code using estimate of the noise power to signal power ratio and syntax deconvwnr
Output:
Source :http://www.mathworks.com/index.html?s_tid=gn_logo