# how to calculate gradient using canny operator in 45 and 135 degrees direction

i want to calculate gradient using canny operator in 45 and 135 degrees direction. Is there any direct formula to get this?

the canny algorithm uses the sobel operator to calculate the gradient direction

atan2(sobelY,sobelX). I am not sure what you are asking, could you clarify your question?It seems that this question is a duplicate of http://answers.opencv.org/question/387. @kritika, is it so?

i think i got my answer from both of your comments @HugoRune and @Kirill Kornyakov..as canny operator uses sobel operator to calculate gradient so the formula given in link http://answers.opencv.org/question/387. works for canny operator also. Am i right?