public Image ThresholdGS(float thresh)
{
Bitmap b = new Bitmap(_image);
for (int i = 0; i < b.Height; ++i)
{
for (int j = 0; j < b.Width; ++j)
{
Color c = b.GetPixel(j, i);
double magnitude = 1 / 3d * (c.B+c.G+c.R);
if (magnitude < thresh)
{
b.SetPixel(j,i,Color.FromArgb(0,0,0));
}
else
{
b.SetPixel(j,i, Color.FromArgb(255,255,255));
}
}
}
return b;
}