The problem with $\left|f\right|$ is that since is not analytic the standard definition of complex derivative does not apply. A solution is to use Wirtinger derivatives: http://en.wikipedia.org/wiki/Wirtinger_derivatives A detailed account of Wirtinger calculus for signal processing problems is http://arxiv.org/abs/0906.4835 Another (probably simpler) option is to treat the complex image as a two-channel (real,imag) image and use the definition of derivative for vector fields. This paper has a very clear explanation on how to do this: [Lee, H.-C.; Cok, D.R.; "Detecting boundaries in a vector field" (IEEE Transactions on Signal Processing, vol.39, no.5, pp.1181-1194, May 1991)](http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=80971&tag=1)