/// <summary> /// Performs dynamic cropping based on the largest bounding box /// encountered (ie smallest cropping) within the 'memory' of the /// autocropper /// </summary> /// <param name="topCrop">Cropping found in current frame</param> /// <param name="bottomCrop">Cropping found in current frame</param> private void MinDynamicCrop(int topCrop, int bottomCrop, int leftCrop, int rightCrop) { if (firstDynamicCrop) { if (verboseLog) { Log.Debug("First dynamic crop, resetting to top {0}, bottom {1}, left {2}, right {3}", topCrop, bottomCrop, leftCrop, rightCrop); } topCropAvg.Reset(topCrop); bottomCropAvg.Reset(bottomCrop); leftCropAvg.Reset(leftCrop); rightCropAvg.Reset(rightCrop); firstDynamicCrop = false; } else { topCropAvg.Add(topCrop); bottomCropAvg.Add(bottomCrop); leftCropAvg.Add(leftCrop); rightCropAvg.Add(rightCrop); } int topMin = (int)topCropAvg.GetMin(); int bottomMin = (int)bottomCropAvg.GetMin(); int leftMin = (int)leftCropAvg.GetMin(); int rightMin = (int)rightCropAvg.GetMin(); if (verboseLog) { Log.Debug("Current topMin {0}, bottomMin {1}, leftMin {2}, rightMin {3}", topMin, bottomMin, leftMin, rightMin); } if (Math.Abs(topMin - lastSettings.Top) > 2 || Math.Abs(bottomMin - lastSettings.Bottom) > 2 || Math.Abs(leftMin - lastSettings.Left) > 2 || Math.Abs(rightMin - lastSettings.Right) > 2) { CropSettings newSettings = new CropSettings(); newSettings.Top = topMin; newSettings.Bottom = bottomMin; newSettings.Left = leftMin; newSettings.Right = rightMin; RequestCrop(newSettings); } }
public void Reset() { InTotal.Reset(); InPerSec.Reset(); OutTotal.Reset(); OutPerSec.Reset(); PendingCount.Reset(); PendingTimeAverage.Reset(); ErrorsTotal.Reset(); ErrorsPerSec.Reset(); ErrorRatio.Reset(); }