private void button2_Click(object sender, EventArgs e) { int[,] FFTNormalized = new int[256, 256]; ImgFFT.MultMass(Out1, Out2); double max = Math.Log(ImgFFT.RealOUT[0, 0] * ImgFFT.RealOUT[0, 0] + ImgFFT.ImagOUT[0, 0] * ImgFFT.ImagOUT[0, 0]); for (int i = 0; i <= 255; i++) { for (int j = 0; j <= 255; j++) { if (Math.Log(ImgFFT.RealOUT[i, j] * ImgFFT.RealOUT[i, j] + ImgFFT.ImagOUT[i, j] * ImgFFT.ImagOUT[i, j]) > max) //Math.Log { max = Math.Log(ImgFFT.RealOUT[i, j] * ImgFFT.RealOUT[i, j] + ImgFFT.ImagOUT[i, j] * ImgFFT.ImagOUT[i, j]); } } } for (int i = 0; i <= 255; i++) { for (int j = 0; j <= 255; j++) { /* FFTLog[i, j] = FFTLog[i, j] / max; * } * for (i = 0; i <= Width - 1; i++) * for (j = 0; j <= Height - 1; j++) * {*/ FFTNormalized[i, j] = (int)(255 * Math.Log(ImgFFT.RealOUT[i, j] * ImgFFT.RealOUT[i, j] + ImgFFT.ImagOUT[i, j] * ImgFFT.ImagOUT[i, j]) / max); } } //Transferring Image to Fourier Plot // FourierPlot = Displayimage(FFTNormalized); Dehologram.Image = (Image)ImgFFT.Displayimage(FFTNormalized); // ImgFFT.MultMass(Out1, Out2); for (int i = 0; i < 255; i++) { for (int j = 0; j < 255; j++) { OpZ[i, j] = /*Math.Sqrt */ (ImgFFT.RealOUT[i, j] * ImgFFT.RealOUT[i, j] + ImgFFT.ImagOUT[i, j] * ImgFFT.ImagOUT[i, j]); } } // Dehologram.Image = (Image)ImgFFT.Displayimage(OpZ); for (int i = 0; i < 255; i++) { for (int j = 0; j < 255; j++) { FourierO[i, j].real = ImgFFT.RealOUT[i, j]; FourierO[i, j].imag = ImgFFT.ImagOUT[i, j]; // pt[i, j] = (int) Out1[i, j].real; // mt[i, j] = (int) Out1[i, j].imag; // ptwithKey[i, j] = (int)Out2[i, j].real; // mtwithKey[i, j] = (int)Out2[i, j].imag; } } // ImgFFT.FFTPlot(FourierO); //ImgFFT.InverseFFT(); //ImgFFT = new FFT(mt); /* ImgFFT.ForwardFFT(); * ImgFFT.FFTShift(); * * ImgFFT.FFTmult(ImgFFT.FFTShifted);*/ //Dehologram.Image = (Image)ImgFFT.Displayimage(ImgFFT.MagniturePlot1); // furiebox2.Image = (Image)ImgFFT.Displayimage(pt); // kMag.Image = (Image)ImgFFT.Displayimage(mt); }
/// <summary> /// Finding Forward FFT of Selected Bitmap /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { //1. Create FFT Object ImgFFT = new FFT(bmp); ImgFFT.ForwardFFT(); // Finding 2D FFT of Image ImgFFT.FFTShift(); for (int i = 0; i < 255; i++) { for (int j = 0; j < 255; j++) { Out1[i, j] = ImgFFT.FFTShifted[i, j]; // OutReal[i, j] = (int)ImgFFT.FFTShifted[i, j].real; // OutImag[i, j] = (int)ImgFFT.FFTShifted[i, j].imag; } } ImgFFT.FFTPlot(ImgFFT.FFTShifted); //ImgFFT.InverseFFT(); for (int i = 0; i < 255; i++) { for (int j = 0; j < 255; j++) { M1[i, j] = ImgFFT.PhasePlot1[i, j]; P1[i, j] = ImgFFT.MagniturePlot1[i, j]; } } furiebox1.Image = (Image)ImgFFT.Displayimage(P1); // Dehologram.Image = (Image)ImgFFT.Obj; // Dehologram.Image = (Image)ImgFFT.Displayimage(OutReal); //furiebox1.Image = (Image)ImgFFT.Displayimage(OutImag); ImgFFT = new FFT(bmp1); ImgFFT.ForwardFFT();// Finding 2D FFT of Image ImgFFT.FFTShift(); for (int i = 0; i < 255; i++) { for (int j = 0; j < 255; j++) { Out2[i, j] = ImgFFT.FFTShifted[i, j]; } } ImgFFT.FFTPlot(ImgFFT.FFTShifted); for (int i = 0; i < 255; i++) { for (int j = 0; j < 255; j++) { M2[i, j] = ImgFFT.PhasePlot1[i, j]; P2[i, j] = ImgFFT.MagniturePlot1[i, j]; } } furiebox2.Image = (Image)ImgFFT.Displayimage(P2); ImgFFT = new FFT(bmp3); ImgFFT.ForwardFFT();// Finding 2D FFT of Image ImgFFT.FFTShift(); for (int i = 0; i < 255; i++) { for (int j = 0; j < 255; j++) { Out3[i, j] = ImgFFT.FFTShifted[i, j]; } } ImgFFT.FFTPlot(ImgFFT.FFTShifted); for (int i = 0; i < 255; i++) { for (int j = 0; j < 255; j++) { keyP[i, j] = ImgFFT.PhasePlot1[i, j]; keyM[i, j] = ImgFFT.MagniturePlot1[i, j]; } } kMag.Image = (Image)ImgFFT.Displayimage(keyM); }