private static bool GetIsGrey(Bitmap bmp, int lineNumber)
{
const int thresholdForGrey = 20;
if (lineNumber >= bmp.Height)
return false; //guard against math errors by the caller
for(int x = 0; x < bmp.Width; x++)
{
var pixelColor = bmp.GetPixel(x, lineNumber);
var rgbDelta = Math.Abs(pixelColor.R - pixelColor.G) + Math.Abs(pixelColor.G - pixelColor.B) + Math.Abs(pixelColor.B - pixelColor.R);
if (rgbDelta > thresholdForGrey)
return false;
}
return true;
}