Gradient directions to radians?



I use 2D convolution of the sobel filter with a binary image to calculate the gradient for each pixel. The x and y directions for the sobel filters are given below:


% Partial derivative in x-direction.
Sx = [-1 -2 -1; 0 0 0; 1 2 1];

% Partial derivative in y-direction.
Sy = [-1 0 1; -2 0 2; -1 0 1];

The convolution is carried out with:

direction_x = conv2(Sx, img);
direction_y = conv2(Sy, img);

But how do I convert the directions in 'direction_y' and 'direction_x' to radians between 0.0 and 2 Pi ?
.