protected override unsafe void ProcessFilter(UnmanagedImage image, Rectangle rect) { // calculate threshold thresholdFilter.ThresholdValue = CalculateThreshold(image, rect); // thresholding thresholdFilter.ApplyInPlace(image, rect); } }