It is used for image sharpening and image edge detection.
Different operators correspond to different methods to find the gradient:
Take Sobel operator (with good effect) as an example:
For digital images, first-order differential can be used instead of first-order differential;
△xf(x,y)=f(x,y)-f(x- 1,y);
△yf(x,y)=f(x,y)-f(x,y- 1)
When calculating the gradient, the sum of squares and the root operation can be expressed by the sum of the absolute values of two components, namely:
G[f(x,y)]={[△xf(x,y)] +[△yf(x,y)] } |△xf(x,y)|+|△yf(x,y)|;
Sobel gradient operator is to do a weighted average first, then differentiate, and then find the gradient, that is:
△xf(x,y)= f(x- 1,y+ 1) + 2f(x,y+ 1) + f(x+ 1,y+ 1)- f(x- 1,y- 1) - 2f(x,y- 1) - f(x+ 1,y- 1)
△yf(x,y)= f(x- 1,y- 1) + 2f(x- 1,y) + f(x- 1,y+ 1)- f(x+ 1,y- 1) - 2f(x+ 1,y) - f(x+ 1,y)
G[f(x,y)]=|△xf(x,y)|+|△yf(x,y)|;