static public Bitmap SimpleMotionBlur(Bitmap Source, float Length) { int OWidth = Source.Width, OHeight = Source.Height; Source = ImgExtend(Source, true); int Width = Source.Width, Height = Source.Height; var ComplexKernel = SimpleComplexKernel(Width, Height, Length, true); int X, Y, T; BGRComplexImg ComplexSource = Img2BGRComplexImg(Source, true); BGRComplexImg ComplexResult = new BGRComplexImg(Width, Height); ComplexSource.FFT2(); AMFT.FFT2(ComplexKernel, AMFT.Direction.Forward); for (Y = 0; Y < Height; ++Y) { for (X = 0; X < Width; ++X) { for (T = 0; T < 3; ++T) { ComplexResult[T][Y, X] = ComplexSource[T][Y, X] * ComplexKernel[Y, X]; } } } ComplexResult.BFFTShift(); ComplexResult.IFFT2(); Bitmap Result = BGRComplexImg2Img(ComplexResult); return(ImgUnExtend(Result, OWidth, OHeight)); }
public void IFFT2(BGRModel Type) { if ((Type & BGRModel.R) == BGRModel.R) { AMFT.FFT2(_R, AMFT.Direction.Backward); } if ((Type & BGRModel.G) == BGRModel.G) { AMFT.FFT2(_G, AMFT.Direction.Backward); } if ((Type & BGRModel.B) == BGRModel.B) { AMFT.FFT2(_B, AMFT.Direction.Backward); } }
public void IFFT2(HSIModel Type) { if ((Type & HSIModel.H) == HSIModel.H) { AMFT.FFT2(_H, AMFT.Direction.Backward); } if ((Type & HSIModel.S) == HSIModel.S) { AMFT.FFT2(_S, AMFT.Direction.Backward); } if ((Type & HSIModel.I) == HSIModel.I) { AMFT.FFT2(_I, AMFT.Direction.Backward); } }