public IList<Polygon> ApplyLabeling(ILabelingService labelingService) { IList<Polygon> polygons = labelingService.Process(this._imageWrapper); this.InitializeBackgroundColor(); this.FilterPolygons(polygons); this.Save("binarized.jpg"); return polygons.Where(p => p.Pixels.Count > AreaTreshold).ToList(); }
public ClassificationService( IImageBinarizer imageBinarizer, IImageProcessor imageProcessor, ILabelingService labelingService, IDistanceCalculator<ClassificationUnit> distanceCalculator, int classNumber) { this._imageBinarizer = imageBinarizer; this._imageProcessor = imageProcessor; this._labelingService = labelingService; this._polygons = new List<Polygon>(); this._classificationUnits = new List<ClassificationUnit>(); this._distanceCalculator = distanceCalculator; this._classNumber = classNumber; this._random = new RNGCryptoServiceProvider(); this._kernels = new List<Kernel>(this._classNumber); }