/// <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; }