/// <summary>
        /// Applies a median filter to a bitmap
        /// </summary>
        /// <param name="sourceBitmap">The source bitmap</param>
        /// <param name="matrixSize">The matrix size</param>
        /// <returns>The modified bitmap</returns>
        public static Bitmap MedianFilter(this Bitmap sourceBitmap, int matrixSize)
        {
            Median filter = new Median();

            filter.DynamicParameter = new MedianParameters {
                MatrixSize = matrixSize
            };

            return(filter.ProcessBitmap(sourceBitmap));
        }