File Exchange

image thumbnail

local depth map (disparity map) estimation from light fields

version (7.19 KB) by Francisco Calderon
A function to explain a stereo-like taxonomy to be used in light field depth estimation


Updated 17 Sep 2015

View License

This file is provided in conjunction to the submission to STSIVA 2014, please read the paper when available to understand the content: Title ---Depth Map Estimation In Light Fields Using An stereo-like taxonomy--
--Abstract-- The light field or LF is a function that describes the amount of light traveling in every direction (angular) through every point (spatial) in a scene, this LF can be captured in several ways, using arraignments of cameras, or more recently using a single camera with an special lens, That allows the capture of angular and spatial information of light rays of a scene (LF). This recent camera implementation gives a different approach to find the dept of a scene using only a single camera. In order to estimate the depth, we describe a taxonomy, similar to the one used in stereo Depth-map algorithms. That consist in the creation of a cost tensor to represent the matching cost between different disparities, then, using a support weight window, aggregate this cost tensor, finally, using a winner-takes-all optimization algorithm, search for the best disparities. This paper explains in detail the several changes made to an stereo-like taxonomy, to be applied in a light field, and evaluate this algorithm using a recent database that for the first time, provides several ground-truth light fields, with a respective ground-truth depth map. (The image of the submission belongs to the Heidelberg Collaboratory for Image Processing HCI)
Francisco Carlos Calderon M.Sc April 2014
Creative commons 2.5 share alike by non-commercial
there are 3 files included:
Dept_vol_subpixel_2: the main function
shift_image: sub function to shift...
PlotDepthdisparity: An extra function to plot "it is not necessary"
You need to use a lightField of dimension LF(t,s,v,u,c) c=colour channels.
please use the help of the functions:
>>help Dept_vol_subpixel_2
>>help shift_image
>>help PlotDepthdisparity


Important notes:

(1) To run our code you need to additionally download the "Guided Image Filter" [K. He, J. Sun, X. Tang, Guided Image Filtering, ECCV10] from Kaiming He's website ( and extract the files "guidedfilter_color.m" and "boxfilter.m" into the same directory as the other Matlab files. we provide a simple modification called guidedfilterx and boxfilterx based in their original works.

(2) The code is provided for academic use only. Use of the code in any commercial or industrial related activities is prohibited.

(3) If you use our code we request that you cite the paper Depth map estimation in light fields using an stereo-like taxonomy

author={Calderon, F.C. and Parra, C.A. and Nino, C.L.},
booktitle={Image, Signal Processing and Artificial Vision (STSIVA), 2014 XIX Symposium on},
title={Depth map estimation in light fields using an stereo-like taxonomy},
keywords={cameras;feature extraction;image processing;image sensors;lenses;optimisation;spatial variables measurement;angular information;cost tensor;depth map estimation;lens;light fields;optimization algorithm;single camera;spatial information;stereo depth-map algorithms;stereo-like taxonomy;support weight window;Cameras;Computer vision;Equations;Estimation;Mathematical model;Stereo vision;Taxonomy;Depth Map;Stereo Light field;Stereo Taxonomy;smoothing filter},

(4) Please use the datasets in and then convert the HDF5 files to matlab and to the LF(t,s,v,u,c) input form. read the documentation and the code first.

Cite As

Francisco Calderon (2020). local depth map (disparity map) estimation from light fields (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (6)

if you have a 15 15 434 625 4 light field image ,how do you do that?

It would be helpful if there was a demo in the zip file

Yong Da

Rameez khan

i need 2d or single image to find its depth map matlab code. thanks

To use:
% To load a 5 5 768 768 3 Light Field matrix of the "papillon" dataset lightField(t,s,v,u,c)

N=6;% subpixel aproximation
[ depth,~ ] = Dept_vol_subpixel_2( lightField, dmin, dmax ,2 ,K ,4 ,N,M);
%[ depth,idx ] = Dept_vol_subpixel_2( LF , dmin, dmax ,angularop,outer,varest,N,M)

PlotDepthdisparity( 1, medfilt2(depth,[M*N,M*N]),dmin,dmax,'disparity subpixel 2' )
PlotDepthdisparity( 2, depth,dmin,dmax,'disparity subpixel 2' )


we update the algoritm to include the recent guided filter and fix some bugs.

minor changes to Description

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