Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How Do I Show value of the Angle After Completing Fourier Transform In Opencv?

I am new in opencv. After completing Fourier transform, i have also got display the angle.I want to show in my window how many degree it is.please give me some idea.

// crop the spectrum, if it has an odd number of rows or columns
    canny_image = canny_image(Rect(0, 0, canny_image.cols & -2, canny_image.rows & -2));


 // rearrange the quadrants of Fourier image  so that the origin is at the image center
    int cx = canny_image.cols/2;
    int cy = canny_image.rows/2;

    Mat q0(canny_image, Rect(0, 0, cx, cy));   // Top-Left - Create a ROI per quadrant
    Mat q1(canny_image, Rect(cx, 0, cx, cy));  // Top-Right
    Mat q2(canny_image, Rect(0, cy, cx, cy));  // Bottom-Left
    Mat q3(canny_image, Rect(cx, cy, cx, cy)); // Bottom-Right

    Mat tmp;                           // swap quadrants (Top-Left with Bottom-Right)
    q0.copyTo(tmp);
    q3.copyTo(q0);
    tmp.copyTo(q3);

    q1.copyTo(tmp);                    // swap quadrant (Top-Right with Bottom-Left)
    q2.copyTo(q1);
    tmp.copyTo(q2);

    normalize(canny_image, canny_image, 0, 1, CV_MINMAX); // Transform the matrix with float values into a
                                            // viewable image form (float between values 0 and 1).
 imshow("spectrum magnitude", canny_image);
click to hide/show revision 2
retagged

updated 2014-06-05 07:46:01 -0600

berak gravatar image

How Do I Show value of the Angle After Completing Fourier Transform In Opencv?

I am new in opencv. After completing Fourier transform, i have also got display the angle.I want to show in my window how many degree it is.please give me some idea.

// crop the spectrum, if it has an odd number of rows or columns
    canny_image = canny_image(Rect(0, 0, canny_image.cols & -2, canny_image.rows & -2));


 // rearrange the quadrants of Fourier image  so that the origin is at the image center
    int cx = canny_image.cols/2;
    int cy = canny_image.rows/2;

    Mat q0(canny_image, Rect(0, 0, cx, cy));   // Top-Left - Create a ROI per quadrant
    Mat q1(canny_image, Rect(cx, 0, cx, cy));  // Top-Right
    Mat q2(canny_image, Rect(0, cy, cx, cy));  // Bottom-Left
    Mat q3(canny_image, Rect(cx, cy, cx, cy)); // Bottom-Right

    Mat tmp;                           // swap quadrants (Top-Left with Bottom-Right)
    q0.copyTo(tmp);
    q3.copyTo(q0);
    tmp.copyTo(q3);

    q1.copyTo(tmp);                    // swap quadrant (Top-Right with Bottom-Left)
    q2.copyTo(q1);
    tmp.copyTo(q2);

    normalize(canny_image, canny_image, 0, 1, CV_MINMAX); // Transform the matrix with float values into a
                                            // viewable image form (float between values 0 and 1).
 imshow("spectrum magnitude", canny_image);