1 回答
TA贡献1831条经验 获得超9个赞
这个评论解决了我的问题。
private void button2_Click(object sender, EventArgs e)
{
Bitmap source = (Bitmap)(pictureBox1.Image as Bitmap).Clone();
int[, ,] array3d = ImageDataConverter.ToInteger3d(source);
int[,] red = ArrayTools<int>.Split(array3d, 0);
int[,] green = ArrayTools<int>.Split(array3d, 1);
int[,] blue = ArrayTools<int>.Split(array3d, 2);
Complex[,] cpxRed = ImageDataConverter.ToComplex(red);
Complex[,] cpxGreen = ImageDataConverter.ToComplex(green);
Complex[,] cpxBlue = ImageDataConverter.ToComplex(blue);
Complex[,] fftCpxRed = FourierTransform.ForwardFFT(cpxRed);
Complex[,] fftCpxGreen = FourierTransform.ForwardFFT(cpxGreen);
Complex[,] fftCpxBlue = FourierTransform.ForwardFFT(cpxBlue);
Complex[,] shiftedFftCpxRed = FourierShifter.ShiftFft(fftCpxRed);
Complex[,] shiftedFftCpxGreen = FourierShifter.ShiftFft(fftCpxGreen);
Complex[,] shiftedFftCpxBlue = FourierShifter.ShiftFft(fftCpxBlue);
int[,] normRed = FourierNormalizer.Normalize(shiftedFftCpxRed, NormalizeType.Magnitude);
int[,] normGreen = FourierNormalizer.Normalize(shiftedFftCpxGreen, NormalizeType.Magnitude);
int[,] normBlue = FourierNormalizer.Normalize(shiftedFftCpxBlue, NormalizeType.Magnitude);
Bitmap mag = ImageDataConverter.ToBitmap3d(normRed, normGreen, normBlue, PixelFormat.Format8bppIndexed);
//Grayscale.SetPalette(mag);
//Bitmap mag = FourierPlot.FftMagnitudePlot(shiftedFftCpxRed, PixelFormat.Format8bppIndexed);
Bitmap phase = FourierPlot.FftPhasePlot(shiftedFftCpxRed, PixelFormat.Format8bppIndexed);
pictureBox2.Image = mag;
pictureBox3.Image = mag;
pictureBox4.Image = phase;
}
- 1 回答
- 0 关注
- 215 浏览
添加回答
举报