Comments: In two dimensions this becomes a little bit more complicated. As demonstrated in one dimension the derivatives of the wrapped and the unwrapped phase should be identical. Therefore, the correct solution of the unwrapping process is the one which mimimizes the differences between the two derivatives. The minimum can be found by searching for the second derivative to be zero.

This can be very easily realized with a least-square implementation using FFTs (IDL download). It is very fast, but the solution of this simple method is not too good, error propagation from low coherent areas and global distortions of the result limit its applicability. More advanced methods are described in literature.