/// <summary> /// Apply filter. /// </summary> /// <param name="data">Matrix</param> public void Apply(Complex32[,] data) { // enhancement or not? if (this.factor != 0) { // params int l0 = data.GetLength(0); int l1 = data.GetLength(1); int i, j; // guided filter Complex32[,] copy = (Complex32[, ])data.Clone(); GuidedFilter.guidedfilter(copy, this.radius, this.eps); // process for (i = 0; i < l0; i++) { for (j = 0; j < l1; j++) { data[i, j] = (1.0 + this.factor) * (data[i, j] - copy[i, j]) + copy[i, j]; } } } return; }
/// <summary> /// Apply filter. /// </summary> /// <param name="data">Array</param> public void Apply(float[] data) { // enhancement or not? if (this.factor != 0) { // params int l0 = data.GetLength(0); int i; // guided filter float[] copy = (float[])data.Clone(); GuidedFilter.guidedfilter(copy, this.radius, this.eps); // process for (i = 0; i < l0; i++) { data[i] = (1.0f + this.factor) * (data[i] - copy[i]) + copy[i]; } } return; }