Here it is finally, Matlab segmentation code for segmenting stereo disparity maps. The code is a combination of Matlab/MEX (Matlab EXecutable) code. MEX part has been programmed in C using openmp and blas in order to make the resulting program more efficient. The  mathematical model, upon which the algorithm is based on, is explained quite well in my phd thesis. Therefore, if you want to get an in depth understanding of the model, or you are interested in level-set based methods, I suggest that you start from there. However, as soon as I get some free time I will explain the model here as well.

Mathematical Model

The model is based on implicit dynamic surfaces (also known as level set theorem) and one of the driving forces is the local length of interface dividing the segments. What this means is that we don't want the interface to be "arbitrarily" long. The theory behind the model is covered briefly here, while both the mathematical model and the exact algorithm implemented in the Matlab code is covered quite extensively in my phd thesis.

Solver

The solver used in the code for solving the resulting equation is based on multigrid. Not only does multigrid improve the convergence speed but it also helps avoiding getting stuck on local solutions. After all, we are interested in a more global solution of the segmentation problem. Reading the code might result somewhat difficult due to the use of multigrid. Below there is an image what we mean with a multigrid.

multi-grid solver

The numbers seen on the vertical axis (1, 2, 3 or 4) refer to image scale where we are trying to solve the equation(s). Scale=1 refers to the full sized disparity map, while scale=4 refers to a scaled down version of the disparity map. Arrows indicate how the algorithm advances between the different scales. This kind of processing, which is typical when solving models based on PDEs (Partial Differential Equation), is called multigrid.

 

Jarno Ralli
Author: Jarno Ralli
Jarno Ralli is a computer vision scientist and a programmer.

Let's get social!

FacebookTwitterGoogle BookmarksLinkedIn