/// <summary> /// Performs inspection on blister image /// </summary> /// <param name="ioImage">Image which will be inspected, and on which results will be drawn</param> public void DoInspection(Image ioImage) { if (isFirstTime) { CreateScanningMaps(ioImage); isFirstTime = false; } Rectangle2D?blisterBoundingBox; LocateBlister(ioImage, out blisterBoundingBox); if (!blisterBoundingBox.HasValue) { throw new ApplicationException("Couldn't locate blister on image!"); } PreprocessBlisterImage(ref ioImage, blisterBoundingBox.Value); var correctCircles = new List <Circle2D>(); var incorrectCircles = new List <Circle2D>(); foreach (var point in referencePoints) { Rectangle2D inspectionRect; AVL.CreateRectangle(point, Anchor2D.MiddleCenter, 0.0f, 102.0f, 102.0f, out inspectionRect); bool isPresent; AVL.CheckPresence_PixelAmount(ioImage, new ShapeRegion(inspectionRect, RectangularRoiMask.Ellipse), null, HSxColorModel.HSV, 26, 52, 42, null, 62, null, 0.8f, 1.0f, out isPresent); Circle2D pillSpot; AVL.CreateCircle(point, Anchor2D.MiddleCenter, 62.0f, out pillSpot); if (isPresent) { correctCircles.Add(pillSpot); } else { incorrectCircles.Add(pillSpot); } } DrawResults(ioImage, correctCircles, incorrectCircles); }