I got the two partial differential function(X direction, Y direction) by using Sobel function in opencv. and then calculated magnitude by using magnitude function.

and get the tangent angle by using phase function.

when I using the phase function I wrote that —> phase(sobel x, sobel y, result, true)

I want calculate normal vector(angle) on the point by using result of phase.

I thought normal = direction / magnitude.

so, I tried … but result looks like wrong.

Can you guys teach to me right method???