/// <summary>
        /// Применить фильтр размытия к исходному изображению.
        /// </summary>
        public void ApllyBlur()
        {
            var bluredImg = _blurFilter.Apply(
                _srcImage, CountPixels);

            BluredImage = bluredImg.ToImageSource();

            _helperIO.WriteImage(
                PathBluredImage, bluredImg);
        }
        /// <summary>
        /// Applies a filter to an image.
        /// </summary>
        /// <param name="filter">The filter to apply. Must not be null.</param>
        /// <param name="image">The image to which the filter is applied.</param>
        /// <returns>A new image with the filter applied.</returns>
        private Image ApplyFilter(IFilterImage filter, Image image)
        {
            // Sanity check input
            if (filter == null)
            {
                throw new ArgumentNullException(nameof(filter));
            }

            if (image == null)
            {
                throw new ArgumentNullException(nameof(image));
            }

            // Create a new bitmap from the existing image
            Bitmap result = new Bitmap(image);

            // Copy the pixel colors of the existing bitmap to a new 2D - color array for further processing.
            Color[,] colors = new Color[result.Width, result.Height];
            for (int x = 0; x < result.Width; x++)
            {
                for (int y = 0; y < result.Height; y++)
                {
                    colors[x, y] = result.GetPixel(x, y);
                }
            }

            //Todo: we can pass the width and height to Apply method , so that no need to get the width and height of image one more time.
            // Apply the user defined filter.
            var filteredImageData = filter.Apply(colors);

            // Copy the resulting array back to the bitmap
            for (int x = 0; x < result.Width; x++)
            {
                for (int y = 0; y < result.Height; y++)
                {
                    result.SetPixel(x, y, filteredImageData[x, y]);
                }
            }

            return(result);
        }