An image gradient is a(or the most) directional change in the intensity or color in an image.
* Canny edge detector uses image gradient for edge detection.
The gradient of a two-variable function (here the image intensity function) at each image point is a 2D vector with the components given by the derivatives in the horizontal and vertical directions.
Image gradient formula:
v¯= f∇ = [∂f/ ∂x, ∂f/ ∂y]
At each image point, the gradient vector points in the direction of largest possible intensity increase, and the length of the g¹radient vector corresponds to the rate of change in that direction.
The gradient direction formula:
θ = tan‾¹[∂f/ ∂x/ ∂f/ ∂y]
The amount of change(size/magnitude):
√((∂f/ ∂x)²+(∂f/ ∂y)²)