Tuesday, September 13, 2016

Shallow Depth-of-Field Generator 11 (SDOFG11)

SDOFG11 simulates a shallow depth-of-field lens effect, commonly seen in macro photography. Because the depth-of-field of modern cameras is quite deep (everything in an image looks quite in focus), it is often necessary (long after the picture was taken) to blur areas of an image that were not meant to be in focus. The shallow depth-of-field lens effect is commonly used to give the impression that objects that are large in real life appear small in the processed image. This effect is commonly known as "miniature faking", "diorama effect", or "tilt-shift photography". In Japan, it's called "bokeh" although "bokeh" implies a special treatment is given to highlights.

The manual for SDOFG11 is in the "ugosoft3d-11-x64.rar" archive. It thoroughly explains the parameters that are needed to run SDOFG11 via the input file "sdofg11_input.txt".

Image for which we want to generate a shallow depth-of-field version. This image comes from the Middlebury stereo database and is called "Dolls".

Depth map (ground-truth) for "Dolls".

Shallow depth-of-field version of the image obtained by SDOFG11.

The windows executable (guaranteed to be virus free) is available for free via the 3D Software Page.


  1. Hi,

    Impressive synthetic bokeh effect !
    Can you explain the main idea of the algorithm used to generate this blurred image ?
    (or may be point some related papers that you found out on the subject).


    1. it's real easy. You just apply a Gaussian filter where the sigma (in the Gaussian filter formula) depends on how far in depth you are from the focus plane. The further in depth from the focus plane, the larger the sigma and the larger the blurring. True bokeh is a little bit more involved since highlights are treated differently from anything else.

  2. I see, thanks for the info.

    I have another questions :) . In one of your previous post,
    you provided a good overview of the The paper from Jon Barron (Fast Bilateral-Space Stereo for Synthetic Defocus).
    Do you know what is the algorithm used for the blurring part ?

    Thanks !

    1. You mean the blurring part for the defocusing? He's using a disc blur instead of a Gaussian blur. Check section 6. "Rendering" of the supplemental of his paper https://people.eecs.berkeley.edu/~barron/BarronCVPR2015_supp.pdf

  3. Hi, it doesn't work on my computer, I have windows 7...when I run the sdofg11 application, it crashes. Is there a solution? Thanks.

    1. Make sure to read sdofg11_manual.pdf. If it still doesn't work, please send me your sdofg11.bat and yout sdofg11_input.txt. Also, it would be nice to copy/paste the output from the program. Thanks.