public static void displayTransform ( InterleavedF32 transform , String name ) { // declare storage GrayF32 magnitude = new GrayF32 ( transform . width , transform . height ) ; GrayF32 phase = new GrayF32 ( transform . width , transform . height ) ; // Make a copy so that you don't modify the input transform = transform . clone ( ) ; // shift the zero-frequency into the image center, as is standard in image processing DiscreteFourierTransformOps . shiftZeroFrequency ( transform , true ) ; // Compute the transform's magnitude and phase DiscreteFourierTransformOps . magnitude ( transform , magnitude ) ; DiscreteFourierTransformOps . phase ( transform , phase ) ; // Convert it to a log scale for visibility PixelMath . log ( magnitude , magnitude ) ; // Display the results BufferedImage visualMag = VisualizeImageData . grayMagnitude ( magnitude , null , - 1 ) ; BufferedImage visualPhase = VisualizeImageData . colorizeSign ( phase , null , Math . PI ) ; ImageGridPanel dual = new ImageGridPanel ( 1 , 2 , visualMag , visualPhase ) ; ShowImages . showWindow ( dual , "Magnitude and Phase of " + name ) ; }
Display the fourier transform s magnitude and phase .