There is a sub-field if image processing called Mathematical Morphology. In this field, we focus on non-linear filters based on max and min operators.
One of the basic filters is thus the dilation, a local maximum filter. Think of a convolution, but instead of multiplying kernel values to image values and adding up the results, we add kernel values to the image values and take the maximum of the result.
With a kernel that is composed of only zeros, this turns into finding the maximum pixel value in a neighborhood.
Using a 3x3 square neighborhood, we obtain the maximum value over the neighboring elements. Subtracting the input, we obtain the largest difference of a pixel with its neighbors.
This difference is not symmetric. That is, if you invert the image by negating each pixel, you would get a different result. By adding in the opposite operation (erosion, a local minimum), it is possible to make the difference symmetric:
$$ \left( \delta(f)-f \right) \vee \left( f-\epsilon(f) \right)$$
($\delta$ is the dilation, $\epsilon$ is the erosion, $f$ is the image, and $\vee$ is the supremum/maximum)