public static WriteableBitmap Make(WriteableBitmap Input, MorphologicalOperation op, bool?[,] matrix3x3 = null)
        {
            if (op == MorphologicalOperation.Dilation)
            {
                return(DilateAndErode(Input, DilateMatrix));
            }
            else if (op == MorphologicalOperation.Erosion)
            {
                var ret = DilateAndErode(Input, ErosionMatrix);
                return(ret.Invert());
            }
            else if (op == MorphologicalOperation.Opening)
            {
                WriteableBitmap newImage = DilateAndErode(Input, ErosionMatrix);
                newImage = newImage.Invert();
                return(DilateAndErode(newImage, DilateMatrix));
            }
            else if (op == MorphologicalOperation.Closing)
            {
                WriteableBitmap newImage = DilateAndErode(Input, DilateMatrix);
                newImage = DilateAndErode(newImage, ErosionMatrix);
                return(newImage.Invert());
            }
            else if (op == MorphologicalOperation.HitOrMiss)
            {
                return(DilateAndErode(Input, matrix3x3));
            }

            return(Input);
        }
예제 #2
0
 internal static extern void cvMorphologyEx(
     Arr src,
     Arr dst,
     Arr temp,
     IplConvKernel element,
     MorphologicalOperation operation,
     int iterations);
예제 #3
0
        private async Task RunMorphological(MorphologicalOperation op, bool?[,] matrix3x3 = null)
        {
            OtsuBinaryzationPageMenuFlyoutItem_Click(null, null);
            AddToUndo(WriteableOutputImage.Clone());
            WriteableOutputImage = MorphologicalHelper.Make(WriteableOutputImage, op, matrix3x3);

            await UpdateOutputImage();
        }
 public GradientEdgeBasedTextDetection(IEdgeDetection edgeDetector, GradientFilter gradientFilter, IGlobalTresholdBinarization binarizator,
     MorphologicalOperation dilation, MorphologicalOperation opening)
 {
     if (edgeDetector == null)
         throw new ArgumentNullException("Null edgeDetector");
     if (gradientFilter == null)
         throw new ArgumentNullException("Null gradientFilter");
     if (binarizator == null)
         throw new ArgumentNullException("Null binarizator");
     if (dilation == null)
         throw new ArgumentNullException("Null dilation");
     if (opening == null)
         throw new ArgumentNullException("Null opening");
     this._edgeDetector = edgeDetector;
     this._gradientFilter = gradientFilter;
     this._binarizator = binarizator;
     this._dilation = dilation;
     this._opening = opening;
 }