# Revision history [back]

### Sobel derivatives in the 45 and 135 degree direction

Hi, From the documentation, the Sobel edge detector seems to work only for horizontal and vertical direction edges (by specifying 0,1 or 1,0). Is there any way to get diagonal edges (i.e. 45deg and 135deg) with cvSobel (not cvCanny)?

Thanks

### Sobel derivatives in the 45 and 135 degree direction

Hi, From the documentation, the Sobel edge detector seems to work only for horizontal and vertical direction edges (by specifying 0,1 or 1,0). Is there any way to get diagonal edges (i.e. 45deg and 135deg) with cvSobel (not cvCanny)?

Thanks

UPDATE: Thanks for the suggestions! I can get what I need by rotating the image beforehand, but it is quite inefficient. I need to access the pixels for both the x-yand diagonal45-diagonal135 matrices, so by rotating the image, I incur the penalty of an extra pass over the pixels.

I've come across : sqrt((Ysin(alpha))^2 + (Xcos(alpha))^2) (where Y and X are derivatives in the y and x direction) which supposedly allows the calculation of the derivative in any direction given by alpha. However, when I try this, the results are different to when rotating the image by 45 degrees before hand. Is that expression correct? If not, how can I go about calculating the derivatives I need without rotating the image beforehand?

Many thanks.

 3 retagged sturkmen 6772 ●3 ●48 ●79 https://github.com/stu...

### Sobel derivatives in the 45 and 135 degree direction

Hi, From the documentation, the Sobel edge detector seems to work only for horizontal and vertical direction edges (by specifying 0,1 or 1,0). Is there any way to get diagonal edges (i.e. 45deg and 135deg) with cvSobel (not cvCanny)?

Thanks

UPDATE: Thanks for the suggestions! I can get what I need by rotating the image beforehand, but it is quite inefficient. I need to access the pixels for both the x-yand diagonal45-diagonal135 matrices, so by rotating the image, I incur the penalty of an extra pass over the pixels.

I've come across : sqrt((Ysin(alpha))^2 + (Xcos(alpha))^2) (where Y and X are derivatives in the y and x direction) which supposedly allows the calculation of the derivative in any direction given by alpha. However, when I try this, the results are different to when rotating the image by 45 degrees before hand. Is that expression correct? If not, how can I go about calculating the derivatives I need without rotating the image beforehand?

Many thanks.

 4 retagged sturkmen 6772 ●3 ●48 ●79 https://github.com/stu...

### Sobel derivatives in the 45 and 135 degree direction

Hi, From the documentation, the Sobel edge detector seems to work only for horizontal and vertical direction edges (by specifying 0,1 or 1,0). Is there any way to get diagonal edges (i.e. 45deg and 135deg) with cvSobel (not cvCanny)?

Thanks

UPDATE: Thanks for the suggestions! I can get what I need by rotating the image beforehand, but it is quite inefficient. I need to access the pixels for both the x-yand diagonal45-diagonal135 matrices, so by rotating the image, I incur the penalty of an extra pass over the pixels.

I've come across : sqrt((Ysin(alpha))^2 + (Xcos(alpha))^2) (where Y and X are derivatives in the y and x direction) which supposedly allows the calculation of the derivative in any direction given by alpha. However, when I try this, the results are different to when rotating the image by 45 degrees before hand. Is that expression correct? If not, how can I go about calculating the derivatives I need without rotating the image beforehand?

Many thanks.