Use the Direction API to compute the main gradients direction in a signal within various regions sizes and positions using the CPU or GPU.
Due to their modular nature, angles may not be just integrated and normalized (like sums) to get a main direction over regions of interest. Here also research efforts were necessary to provide this possibility.
As a region may contain many different local gradient directions, this computation can be considered an average gradient direction, each contribution being weighted by the local gradient magnitude.
The gradient direction computed information is the slope. If required, you can compute the corresponding angle (in radians) with atan(slope).
Optionally, you may request the corresponding gradient magnitude of the region. If the magnitude is close to zero, the gradient direction may not be relevant if the noise level is significant.