Gradient is a vector that is made up from a the derivatives of multi-variate function.
Gradient of an Image = ∇f = [∂f/∂x,∂f/∂y]
The gradient of a function is the vector direction/angle of the most rapid increase in Intensity(Getting Brighter), and the magnitude of that vector is how much it is changing as a function of a unit step in that direction.
Atan2 = ArcTan=Θ = Tan¯¹((∂f/∂y)/∂f/∂x) with respect to no zero division.
Amount/Magnitude of change = | |∇f || = sqrt((∂f/∂y)**2 +(∂f/∂x)**2)