/// <summary>
        /// Выделение текста на единичном кадре видеопотока
        /// </summary>
        /// <param name="videoFrame">Кадр видео</param>
        /// <returns>true</returns>
        public Task<bool> DetectText(GreyVideoFrame videoFrame, int threadsNumber)
        {
            try
            {
                if (videoFrame == null || videoFrame.Frame == null)
                    throw new ArgumentNullException("Null frame in DetectText");

                return Task.Run(() =>
                {
                    if (videoFrame.NeedProcess)
                    {
                        EdgeDetectionFilter sobel = new SobelFilter();
                        GradientFilter gradientFiler = new SimpleGradientFilter();
                        SmoothingFilter gauss = null; //new GaussFilter(this.GaussFilterSize, this.GaussFilterSigma);
                        SmoothingFilter gaussForCanny = null;

                        SWTTextDetection sWTTextDetection = null;
                        if (ParametersUndefined(videoFrame))
                        {
                            if (this.UseAdaptiveSmoothing)
                                gaussForCanny = new AdaptiveGaussFilter(this.GaussFilterSigma);
                            else
                                gaussForCanny = new GaussFilter(this.GaussFilterSize, this.GaussFilterSigma);
                            gauss = new GaussFilter(this.GaussFilterSize, this.GaussFilterSigma);
                            CannyEdgeDetection canny = new CannyEdgeDetection(gaussForCanny, sobel, this.CannyLowTreshold, this.CannyHighTreshold);

                            sWTTextDetection = new SWTTextDetection(canny, gauss, gradientFiler, this.VarienceAverageSWRation,
                                            this.AspectRatio, this.DiamiterSWRatio, this.BbPixelsNumberMinRatio, this.BbPixelsNumberMaxRatio, this.ImageRegionHeightRationMin,
                                            this.ImageRegionWidthRatioMin, this.PairsHeightRatio, this.PairsIntensityRatio, this.PairsSWRatio,
                                            this.PairsWidthDistanceSqrRatio, this.PairsOccupationRatio, this.MinLettersNumberInTextRegion, this.MergeByDirectionAndChainEnds);
                        }
                        else
                        {
                            if (videoFrame.UseAdaptiveSmoothing)
                                gaussForCanny = new AdaptiveGaussFilter(videoFrame.GaussFilterSigma);
                            else
                                gaussForCanny = new GaussFilter(videoFrame.GaussFilterSize, videoFrame.GaussFilterSigma);
                            gauss = new GaussFilter(videoFrame.GaussFilterSize, videoFrame.GaussFilterSigma);
                            CannyEdgeDetection canny = new CannyEdgeDetection(gaussForCanny, sobel, videoFrame.CannyLowTreshold, videoFrame.CannyHighTreshold);

                            sWTTextDetection = new SWTTextDetection(canny, gauss, gradientFiler, videoFrame.VarienceAverageSWRation, videoFrame.AspectRatio,
                                videoFrame.DiamiterSWRatio, videoFrame.BbPixelsNumberMinRatio, videoFrame.BbPixelsNumberMaxRatio, videoFrame.ImageRegionHeightRationMin,
                                videoFrame.ImageRegionWidthRatioMin, videoFrame.PairsHeightRatio, videoFrame.PairsIntensityRatio, videoFrame.PairsSWRatio,
                                videoFrame.PairsWidthDistanceSqrRatio, videoFrame.PairsOccupationRatio, videoFrame.MinLettersNumberInTextRegion, videoFrame.MergeByDirectionAndChainEnds);
                        }
                        sWTTextDetection.DetectText(videoFrame.Frame, threadsNumber);
                    }
                    return true;
                });
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
        /// <summary>
        /// Выделение текста на кд\лючевых кадрах видеоролика
        /// </summary>
        /// <param name="video">Видеоролик</param>
        /// <returns>true</returns>
        public Task<bool> DetectText(GreyVideo video, int threadsNumber)
        {
            try
            {
                if (video == null)
                    throw new ArgumentNullException("Null video in DetectText");
                if (video.Frames == null)
                    throw new ArgumentNullException("Null video frames in DetectText");

                return Task.Run(() =>
                {
                    for (int i = 0; i < video.Frames.Count; i++)
                        if (video.Frames[i].NeedProcess)
                        {
                            EdgeDetectionFilter sobel = new SobelFilter();
                            SmoothingFilter gauss = new GaussFilter(this.GaussFilterSize, this.GaussFilterSigma);
                            GradientFilter gradientFiler = new SimpleGradientFilter();
                            CannyEdgeDetection canny = new CannyEdgeDetection(gauss, sobel, this.CannyLowTreshold, this.CannyHighTreshold);

                            SWTTextDetection SWTTextDetection = new SWTTextDetection(canny, null, gradientFiler, this.VarienceAverageSWRation,
                                this.AspectRatio, this.DiamiterSWRatio, this.BbPixelsNumberMinRatio, this.BbPixelsNumberMaxRatio, this.ImageRegionHeightRationMin,
                                this.ImageRegionWidthRatioMin, this.PairsHeightRatio, this.PairsIntensityRatio, this.PairsSWRatio,
                                this.PairsWidthDistanceSqrRatio, this.PairsOccupationRatio, this.MinLettersNumberInTextRegion, this.MergeByDirectionAndChainEnds);

                            SWTTextDetection.DetectText(video.Frames[i].Frame, threadsNumber);
                        }
                   return true;
                });
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }