public void Analyze(string logsFilePath)
        {
            var events         = _logsFileParser.Parse(logsFilePath);
            var detectedEvents = _detector.Detect(events);

            _eventStore.Insert(detectedEvents.Select(c => new DAL.Event(c.Id, c.DurationInMilliseconds, c.Type, c.Host, c.Alert)).ToList());
        }
        public DetectorPageViewModel(string path)
        {
            FaceImage = ImageSource.FromFile(path);
            FaceDetectorImpl.ImagePath = path;
            FaceDetectorImpl.Decode();

            DetectCommand = new Command(async() => RefreshPage(await FaceDetectorImpl.Detect()));
        }
        public async Task <(IEnumerable <Violation> Violations, IEnumerable <Human> Humans)> Detect(Mat image)
        {
            return(await Task.Run(delegate
            {
                lock (detectorLockLink)
                {
                    var humans = new List <Human>();
                    var violations = new List <Violation>();
                    try
                    {
                        var items = detector.Detect(image);
                        foreach (var(Confidence, CenterX, CenterY, Width, Height) in items)
                        {
                            var human = new Human(CenterX - (Width / 2), CenterY - (Height / 2), Width, Height, image.Width, image.Height);

                            var pers = session.GridProjection.Perspective(human.BottomCenter);
                            if (pers.HasValue)
                            {
                                human.PerspectivePoint = pers.Value;
                                humans.Add(human);
                            }
                        }
                        foreach (var i in humans)
                        {
                            foreach (var j in humans)
                            {
                                if (i == j)
                                {
                                    continue;
                                }
                                if (violations.Any(v =>
                                                   (i.BottomCenter == v.Line.A && j.BottomCenter == v.Line.B) ||
                                                   (i.BottomCenter == v.Line.B && j.BottomCenter == v.Line.A) ||
                                                   (j.BottomCenter == v.Line.A && i.BottomCenter == v.Line.B) ||
                                                   (j.BottomCenter == v.Line.B && i.BottomCenter == v.Line.A)))
                                {
                                    continue;
                                }
                                if (session.GridProjection.IsProjectionReady)
                                {
                                    double dis = GeometryHelpers.GetDistance(i.PerspectivePoint, j.PerspectivePoint);
                                    if (dis < ViolationThreshold)
                                    {
                                        i.IsViolation = true;
                                        j.IsViolation = true;
                                        violations.Add(new Violation(new RelativeLine(i.BottomCenter, j.BottomCenter), dis));
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                    return (violations, humans);
                }
            }));
        public IDictionary <string, SideBySideDiffModel> Check(SavedWebpage webpage, Uri url)
        {
            var tempWebpage     = _downloader.Download(url, String.Empty, true);
            var originalWebpage = ConvertToWebpage(webpage);

            var diff = _detector.Detect(originalWebpage, tempWebpage);

            return(diff);
        }
        public DetectorPageViewModel(string path)
        {
            BarcodeImage = ImageSource.FromFile(path);

            BarcodeDetectorImpl.ImagePath = path;
            BarcodeDetectorImpl.Decode();

            DetectCommand = new Command(
                async() =>
            {
                try
                {
                    RefreshPage(await BarcodeDetectorImpl.Detect());
                    DetectionResultText = $"Success";
                }
                catch (Exception e)
                {
                    DetectionResultText = $"Failure";
                }
            }
                );
        }
        public void DetectChanges(XRayImage xRayImageAfter, XRayImage imagesDiff, IDetector detector)
        {
            var imageAfter = xRayImageAfter.XRayBitmap;

            BitmapSource bitmapSourceAfter   = new FormatConvertedBitmap(imageAfter, PixelFormats.Pbgra32, null, 0);
            var          imagesAfterWritable = new WriteableBitmap(bitmapSourceAfter);
            var          imagesDiffWritable  = new WriteableBitmap(bitmapSourceAfter);

            var width  = imageAfter.PixelWidth;
            var height = imageAfter.PixelHeight;

            var pixelDataAfter = new int[width * height];
            var pixelDataDiff  = new int[width * height];
            var widthInByte    = 4 * imageAfter.PixelWidth;

            imagesAfterWritable.CopyPixels(pixelDataAfter, widthInByte, 0);
            imagesDiffWritable.CopyPixels(pixelDataDiff, widthInByte, 0);

            detector.Detect(pixelDataAfter, pixelDataDiff, width, height);

            imagesDiffWritable.WritePixels(new Int32Rect(0, 0, width, height), pixelDataDiff, widthInByte, 0);
            imagesDiff.XRayBitmap = imagesDiffWritable.ToBitmapImage();
        }
Beispiel #7
0
 public IModalDialog Detect(Type type)
 {
     return(Detector.Detect(type));
 }
Beispiel #8
0
 protected static Screen Detect(params Type[] screenTypes)
 {
     return((!screenTypes.Any()) ? ScreenDetector.Detect() : ScreenDetector.Detect(screenTypes));
 }
 /// <summary>
 /// Detects is there Dwm in container.
 /// </summary>
 /// <param name="detector">Detecting algorithm.</param>
 /// <param name="inputStream">Conteiner file stream.</param>
 /// <returns>True if Dwm exists in container or false if it is not.</returns>
 public static bool DetectDwm(IDetector detector, Stream inputStream)
 {
     Container container = new Container(inputStream);
     return detector.Detect(container);
 }
Beispiel #10
0
 public virtual Screen Detect(Type type)
 {
     return(Detector.Detect(type));
 }
Beispiel #11
0
 public virtual IModalDialog DetectModalDialog()
 {
     return(ModalDialogDetector.Detect());
 }