/// <summary> /// Called when [pass of window]. /// </summary> /// <param name="src">The source.</param>// /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="step">The step.</param> private Task <List <RecognizedObject> > OnePassOfWindow(BitmapSource src, int width, int height, int step) { var recognizedList = new List <RecognizedObject>(); int counter = 0; return(Task.Run(() => { for (int i = 0; i < src.Height - height; i += 2 * step) { for (int j = 0; j < src.Width - width; j += step) { var frame = new Int32Rect(j, i, width, height); var croppedImage = _imageProcessor.CropImage(src, frame); var resizedImage = _imageProcessor.ResizeImage(croppedImage); //var exactBitmap = GetBitmap(resizedImage); var hog = ExtractHog(resizedImage.ToByteArray()).ToArray(); //var hog = ExtractHogAccord(exactBitmap).ToArray(); double percent = _svm.Probability(hog); bool isHuman = percent >= Constants.ETALON_PERCENTAGE; if (isHuman) { recognizedList.Add(new RecognizedObject { ID = counter, Percentage = percent, Frame = frame, Image = croppedImage, Name = $"{width}_{height}_{counter}" }); resizedImage.SaveImage($"{width}_{height}_{percent}.png"); counter += 1; } } } return recognizedList; } )); }