public static Bitmap FloodFill(Bitmap image, int xpixel, int ypixel, double threshold, Bgr myColor)
{
AForge.Imaging.Filters.PointedColorFloodFill filter = new PointedColorFloodFill();
int thresh = (int)threshold;
filter.Tolerance = Color.FromArgb(thresh, thresh, thresh);
filter.FillColor = Color.Black;
filter.StartingPoint = new IntPoint(xpixel, ypixel);
Bitmap dotjpg = AForge.Imaging.Image.Clone(image, PixelFormat.Format24bppRgb); //force the jpgs
return filter.Apply(dotjpg);
}