Ask Your Question

What is the cartToPolar angle direction in OpenCV?

asked 2013-04-08 06:26:15 -0600

Milanista gravatar image

updated 2013-04-08 07:28:27 -0600


I would like to ask, where exactly the angle computed by carToPolar function points? For example, if I have a 3x3 MAT matrix, and the angle at point [1,1] is 45°, it will point to [2,2] or [0,2] ?

Thank you

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2013-04-08 07:27:43 -0600

Basically it the output is calculated clockwise starting from the x - axis. This is dependant on how the axes in OpenCV are actually visualized. So take a look at the following picture.

image description

This means that if a point [1,1] has a gradient angle of 45°, it will point towards the pixel that is at 45° looking from the coordinate center. In this case it will be [2,2]. An angle of 90° would point to [2,0].

edit flag offensive delete link more


Thank you very much!

Milanista gravatar imageMilanista ( 2013-04-08 09:09:22 -0600 )edit

If it helped you, accept the answer, so that this topic appears solved. You are welcome!

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-08 09:38:32 -0600 )edit

Question Tools


Asked: 2013-04-08 06:26:15 -0600

Seen: 2,805 times

Last updated: Apr 08 '13