private void ExecuteAdaptiveThreshold(XmlElement element, MagickImage image)
{
Hashtable arguments = new Hashtable();
foreach (XmlAttribute attribute in element.Attributes)
{
if (attribute.Name == "bias")
arguments["bias"] = Variables.GetValue<double>(attribute);
else if (attribute.Name == "biasPercentage")
arguments["biasPercentage"] = Variables.GetValue<Percentage>(attribute);
else if (attribute.Name == "height")
arguments["height"] = Variables.GetValue<Int32>(attribute);
else if (attribute.Name == "width")
arguments["width"] = Variables.GetValue<Int32>(attribute);
}
if (OnlyContains(arguments, "width", "height"))
image.AdaptiveThreshold((Int32)arguments["width"], (Int32)arguments["height"]);
else if (OnlyContains(arguments, "width", "height", "bias"))
image.AdaptiveThreshold((Int32)arguments["width"], (Int32)arguments["height"], (double)arguments["bias"]);
else if (OnlyContains(arguments, "width", "height", "biasPercentage"))
image.AdaptiveThreshold((Int32)arguments["width"], (Int32)arguments["height"], (Percentage)arguments["biasPercentage"]);
else
throw new ArgumentException("Invalid argument combination for 'adaptiveThreshold', allowed combinations are: [width, height] [width, height, bias] [width, height, biasPercentage]");
}
private void ExecuteAddNoise(XmlElement element, MagickImage image)