Binary dilatation operator from Mathematical Morphology with 3x3 structuring element.

The filter represents an optimized version of Dilatation filter, which is aimed for binary images (containing black and white pixels) processed with 3x3 structuring element. This makes this filter ideal for growing objects in binary images – it puts white pixel to the destination image in the case if there is at least one white neighbouring pixel in the source image.

See Dilatation filter, which represents generic version of dilatation filter supporting custom structuring elements and wider range of image formats.

The filter accepts 8 bpp grayscale (binary) images for processing.

Inheritance: BaseUsingCopyPartialFilter
Example #1
0
 // On Filters->BinaryDilatation3x3
 private void BinaryDilatationFiltersItem_Click(object sender, EventArgs e)
 {
     ApplyFilter(Grayscale.CommonAlgorithms.BT709);
     // ApplyFilter(new SobelEdgeDetector());
     BinaryDilatation3x3 filter = new BinaryDilatation3x3();
     // apply the filter
     filter.ApplyInPlace(filteredImage);
     BinaryDilatationFiltersItem.Checked= true;
 }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        /// <remarks></remarks>
        public TileOCR(string trainingPath)
        {
            classifier = new KNearestClassifier(1, Metric.EuclideanDistance, WeightMode.InverseDistance);
            training = LoadInstancesFromBitmaps(trainingPath);
            
            classifier.Train(training);

            results = new List<OCRResult>();

            grayscale = new Grayscale(0, 0.85, 0.15);
            invert = new Invert();
            resize = new ResizeNearestNeighbor(32, 32);
            floodFill = new PointedColorFloodFill(Color.Black);
            dilate = new BinaryDilatation3x3();
            blobCounter = new BlobCounter();
            blobCounter.FilterBlobs = true;
            blobCounter.MinWidth = 4;
            blobCounter.MinHeight = 14;
            blobCounter.MaxWidth = 30;
            blobCounter.MaxHeight = 30;
            blobCounter.ObjectsOrder = ObjectsOrder.XY;
            threshold = new BradleyLocalThresholding();
            threshold.PixelBrightnessDifferenceLimit = 0;
            //Threshold.WindowSize = 20;
            threshold.WindowSize = 24;
        }