public ImageProcessorsResult ProcessImage(string processorName, string imageName)
 {
     var result = new ImageProcessorsResult();
     var sourceImage = _imageRepository.GetImageAsync(imageName).Result;
     var processResult = _imageProcessorService.ProcessImageAsync(processorName, sourceImage).Result;
     if (processResult.Successful)
     {
         result.Successful = true;
         _imageRepository.SaveImageAsync(processResult.ProcessedImage).Wait();
         result.ProcessedImageUrl = _imageUrlProvider.GetImageUrl(processResult.ProcessedImage.Name);
         result.ProcessedImageName = processResult.ProcessedImage.Name;
         result.SourceImageUrl = _imageUrlProvider.GetImageUrl(sourceImage.Name);
         result.SourceImageName = sourceImage.Name;
     }
     else
     {
         result.Successful = false;
     }
     return result;
 }
        private async void button1_Click(object sender, EventArgs e)
        {
            var imageDataProvider = new ImageDataProvider();
            var imageFactory = new ImageFactory();

            var convolutionFilter = new Bsuir.Misoi.Core.Images.Implementation.ConvolutionFilter();

            var binarizationFilter = new BinarizationFilter();
            var segmentationAlogithm = new SegmentationAlgorithm(binarizationFilter);
            var findResultDrawer = new FindResultDrawer();

            var _imageProcessorService = new ImageProcessorsService(convolutionFilter, segmentationAlogithm, findResultDrawer);

            var _imageRepository = new ImageRepository(imageDataProvider, imageFactory);

            var _imageUrlProvider = new ImageUrlProvider();

            var bitmap = new Bitmap(pictureBox1.Image);
            var iimage = new BitmapImage(bitmap);
            var result = new ImageProcessorsResult();
            var sourceImage = iimage;

            var processResult = _imageProcessorService.ProcessImageAsync("Clip document", sourceImage).Result;
            if (processResult.Successful)
            {
                result.Successful = true;
                _imageRepository.SaveImageAsync(processResult.ProcessedImage).Wait();
                result.ProcessedImageUrl = _imageUrlProvider.GetImageUrl(processResult.ProcessedImage.Name);
                result.ProcessedImageName = processResult.ProcessedImage.Name;
                result.SourceImageUrl = _imageUrlProvider.GetImageUrl(sourceImage.Name);
                result.SourceImageName = sourceImage.Name;
                pictureBox2.Image = new Bitmap(processResult.ProcessedImage.Name + ".jpg");
            }
            else
            {
                result.Successful = false;
            }
            // return result;


        }