# Revision history [back]

First split the complex (2 channel) image in two separate images containing the real and imaginary part:

Mat planes[2];
split(canny_image,planes);


...assuming that the canny_image is complex. Then use the cartToPolar function to get the phase (angle) and magnitude:

Mat magn,angl;
cartToPolar(planes[0],planes[1],magn,angl);


You can do this in two steps using the magnitude and phase functions in a similar manner.

First split the complex (2 channel) image in two separate images containing the real and imaginary part:

Mat planes[2];
split(canny_image,planes);


...assuming that the canny_image is complex. Then use the cartToPolar function to get the phase (angle) and magnitude:

Mat magn,angl;
cartToPolar(planes[0],planes[1],magn,angl);
cartToPolar(planes[0],planes[1],magn,angl,true);


The last parameter (true) defines that you want the results in degrees.

You can do this in two steps using the magnitude and phase functions in a similar manner.