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