File Exchange

image thumbnail

Defocus simulation

version 1.0.0.0 (84.8 KB) by Said Pertuz
Simulate shift-variant defocus blur

10 Downloads

Updated 26 Jan 2016

View License

This function simulates the shift-variant defocus blur due to the limited depth of field of a digital camera. It works my mapping a source irrandiance (image) to a given depthmap and generates an image sequence at different focus positions using a gaussian PSF derived from geometrical optics. For a detailed description of its working principles, refer to appendix B in [1]. This defocus model has been used in [2] and [3]. For a demo, simply run 'blurdemo' at the matlab prompt.
References:
[1] S. Pertuz, Modeling and applications of the focus cue in conventional digital cameras. PhD thesis. Universitat Rovira i Virgili, 2013.
[2] S. Pertuz, D. Puig, M. A. Garcia, Analysis of focus measure operators for shape-from-focus, Pattern Recognition, 46(5): 1415-1432, 2013.
[3] S. Pertuz, D. Puig, M. A. Garcia, Reliability measure for shape-from-focus, Image and Vision Computing, Volume 31(10):725–734, 2013

Cite As

Said Pertuz (2020). Defocus simulation (https://www.mathworks.com/matlabcentral/fileexchange/55095-defocus-simulation), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Lucas Chen

Noted that the shape 'sphere' should have its absolute value take before displaying.

Lucas Chen

Thanks a lot!!

Mahi

Hi,
Your code was excellent...!
I have a question:
*) I already have a defocused image, I want to make it clear. May I know, if I can use your code to remove defocus problem?
Thanking you in anticipation.
Regards,
Mahi

lollows

dong

I want to ask you some questions about simulation of PSF. Could I know your email? My email is cxd15505@gmail.com

Updates

1.0.0.0

- Display figure has been updated

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: Shape from focus