private static ISingleEyeGazeDataSmoothingFilter ResolveSmoothingFilter(INoiseReductionOptions options) { switch (options.NoiseReductionStrategy) { case NoiseReductionStrategy.Exponential: var exponentialOptions = options as IExponentialSmoothingOptions; return(exponentialOptions != null ? new ExponentialSmoothingFilter(exponentialOptions.Alpha) : new ExponentialSmoothingFilter()); case NoiseReductionStrategy.MovingAverage: var movingAverageOptions = options as IMovingAverageSmoothingOptions; return(movingAverageOptions != null ? new MovingAverageSmoothingFilter(movingAverageOptions.WindowSize) : new MovingAverageSmoothingFilter()); case NoiseReductionStrategy.Median: default: throw new NotImplementedException(); } }
public static IObservable <SingleEyeGazeData> ReduceNoise(this IObservable <SingleEyeGazeData> gazeData, INoiseReductionOptions options) { return(ReduceNoise(gazeData, ResolveSmoothingFilter(options))); }