To obtain the gradient from an image, one can use a linear filter that for example is derrived from the derrivative of a gaussian. Then convolving the image with this linear filter gives you the gradient image. The gradient magnitude can also be approximated by use of (grayscale) morphological gradients, such as: (dilation-erosion), (opening-closing), or ((dilation-erosion)-(opening-closing)). Why would you resort to using a (grayscale) morphological approximation of the gradient magnitude? Is it any faster or is it different in some cases? Thanks, Tom
I've spent few years working with specialists on mathematical morphology, and I didn't get a mathematical answer why morphological gradient was better than a classical convolution. It was more a choice of ideology.
However, the results are a little bit different and according to the problem, you can choose one over the other.
But morphological gradient is super fast, because it is usually performed with a small structuring element (radius 1 or 2) of type square or hexagon, so you can use SIMD/SSE optimization.