public Streams([NotNull] ICamera camera, [NotNull] IDenoiser denoiser, [NotNull] IBackgroundSubtractor subtractor, [NotNull] ICorrector corrector, [NotNull] IPeopleDetector detector) { Camera = camera ?? throw new ArgumentNullException(nameof(camera)); Denoiser = denoiser ?? throw new ArgumentNullException(nameof(denoiser)); Subtractor = subtractor ?? throw new ArgumentNullException(nameof(subtractor)); Corrector = corrector ?? throw new ArgumentNullException(nameof(corrector)); Detector = detector ?? throw new ArgumentNullException(nameof(detector)); }
private static void RunManagedDenoiser(uint[] pixels, int width, int height, uint onColour, uint offColour, IDenoiser denoiser) { var context = new Context() { Pixels = pixels, CheckedPixels = new int[width * height], ObjectPixelsIndex = new int[width * height], ObjectPixelsCount = -1, ObjectPixelsYFrom = int.MaxValue, ObjectPixelsYTo = int.MinValue, ObjectPixelsXFrom = int.MaxValue, ObjectPixelsXTo = int.MinValue, Index = -1, Width = width, Height = height, MaxIndex = width * height, ColorOn = onColour, ObjectPixelsPath = new Stack <int>() }; context.Denoiser = denoiser; do { int nextObjectPixelId = FindNextObjectPixel(context); if (nextObjectPixelId != -1) { CheckAndRemoveNoiseObjectAsNecessary(context, nextObjectPixelId, offColour); } else { break; } }while (true); }