public static void Run()
{
// ExStart:Bradleythreshold
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages() + "sample.bmp";
// Load an existing image.
using (var objimage = (BmpImage)Image.Load(dataDir))
{
// Define threshold value, Call BinarizeBradley method and pass the threshold value as parameter and Save the output image
double threshold = 0.15;
objimage.BinarizeBradley(threshold);
objimage.Save(dataDir + "binarized_out.png");
}
// ExEnd:Bradleythreshold
}
}