DEMO 1: Least Squares Shape from Defocus

Geometric Blind Deconvolution

Demonstration of the geometric blind deconvolution method for shape from defocus

clear all, close all

Generate defocus operators

Compute a set of orthogonal operators with rank 49 for a fixed number of depth levels

Hp = generate_operators(7,49);
Computing orthogonal operators (Gaussian kernel)
50 Levels
    Done.

Load defocused images

Load images I1 and I2 (far and near focused images)

load DataSet

Estimate depth

Perform an exhaustive search for the minimum of the residuals obtained by applying the orthogonal operators to each patch of the input images

Depth = estimate_depth(I1,I2,Hp,1);
Computing depth levels
50 Iterations
done.

Optional smoothing

Eliminate undesired estimation errors via median filtering

FilteredDepth = mediansmoothing(Depth,1);