Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

More info here: http://docs.opencv.org/modules/core/doc/operations_on_arrays.html

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.

More info here: http://docs.opencv.org/modules/core/doc/operations_on_arrays.html