private static bool IsMatchPointBackGround(NOcrPoint op, bool loose, NikseBitmap nbmp, NOcrChar nOcrChar) { foreach (Point point in op.ScaledGetPoints(nOcrChar, nbmp.Width, nbmp.Height)) { if (point.X >= 0 && point.Y >= 0 && point.X < nbmp.Width && point.Y < nbmp.Height) { Color c = nbmp.GetPixel(point.X, point.Y); if (c.A > 150 && c.R + 100 + c.G + c.B > VobSubOcr.NocrMinColor) { return(false); } if (nbmp.Width > 10 && point.X + 1 < nbmp.Width) { c = nbmp.GetPixel(point.X + 1, point.Y); if (c.A > 150 && c.R + 100 + c.G + c.B > VobSubOcr.NocrMinColor) { return(false); } } if (loose) { if (nbmp.Width > 10 && point.X >= 1) { c = nbmp.GetPixel(point.X - 1, point.Y); if (c.A > 150 && c.R + 100 + c.G + c.B > VobSubOcr.NocrMinColor) { return(false); } } if (nbmp.Height > 10 && point.Y + 1 < nbmp.Height) { c = nbmp.GetPixel(point.X, point.Y + 1); if (c.A > 150 && c.R + 100 + c.G + c.B > VobSubOcr.NocrMinColor) { return(false); } } if (nbmp.Height > 10 && point.Y >= 1) { c = nbmp.GetPixel(point.X, point.Y - 1); if (c.A > 150 && c.R + 100 + c.G + c.B > VobSubOcr.NocrMinColor) { return(false); } } } } } return(true); }
private static bool IsMatchPointForeGround(NOcrPoint op, bool loose, NikseBitmap nbmp, NOcrChar nOcrChar) { if (Math.Abs(op.Start.X - op.End.X) < 2 && Math.Abs(op.End.Y - op.Start.Y) < 2) { return(false); } foreach (Point point in op.ScaledGetPoints(nOcrChar, nbmp.Width, nbmp.Height)) { if (point.X >= 0 && point.Y >= 0 && point.X < nbmp.Width && point.Y < nbmp.Height) { Color c = nbmp.GetPixel(point.X, point.Y); if (c.A > 150) { } else { return(false); } if (loose) { if (nbmp.Width > 10 && point.X + 1 < nbmp.Width) { c = nbmp.GetPixel(point.X + 1, point.Y); if (c.A > 150) { } else { return(false); } } if (nbmp.Width > 10 && point.X >= 1) { c = nbmp.GetPixel(point.X - 1, point.Y); if (c.A > 150) { } else { return(false); } } if (nbmp.Height > 10 && point.Y + 1 < nbmp.Height) { c = nbmp.GetPixel(point.X, point.Y + 1); if (c.A > 150) { } else { return(false); } } if (nbmp.Height > 10 && point.Y >= 1) { c = nbmp.GetPixel(point.X, point.Y - 1); if (c.A > 150) { } else { return(false); } } } } } return(true); }