internal static int IsBitmapsAlike(NikseBitmap bmp1, Ocr.Binary.BinaryOcrBitmap bmp2)
        {
            int different = 0;
            int maxDiff   = bmp1.Width * bmp1.Height / 5;
            int w4        = bmp1.Width * 4;

            for (int y = 1; y < bmp1.Height; y++)
            {
                var alpha = y * w4 + 7;
                var pixel = y * bmp2.Width + 1;
                for (int x = 1; x < bmp1.Width; x++)
                {
                    if (bmp1.GetAlpha(alpha) < 100 && bmp2.GetPixel(pixel) > 0)
                    {
                        different++;
                    }

                    pixel++;
                    alpha += 4;
                }
                if (different > maxDiff)
                {
                    return(different + 10);
                }
            }
            return(different);
        }
示例#2
0
        internal static int IsBitmapsAlike(NikseBitmap bmp1, Ocr.Binary.BinaryOcrBitmap bmp2)
        {
            int different = 0;
            int maxDiff   = bmp1.Width * bmp1.Height / 5;

            for (int x = 1; x < bmp1.Width; x++)
            {
                for (int y = 1; y < bmp1.Height; y++)
                {
                    if (bmp1.GetAlpha(x, y) < 100 && bmp2.GetPixel(x, y) > 0)
                    {
                        different++;
                    }
                }
                if (different > maxDiff)
                {
                    return(different + 10);
                }
            }
            return(different);
        }
示例#3
0
        internal static int IsBitmapsAlike(Ocr.Binary.BinaryOcrBitmap bmp1, NikseBitmap bmp2)
        {
            int different = 0;
            int maxDiff   = bmp1.Width * bmp1.Height / 5;

            for (int x = 0; x < bmp1.Width; x++)
            {
                for (int y = 0; y < bmp1.Height; y++)
                {
                    //if (!IsColorClose(bmp1.GetPixel(x, y), bmp2.GetPixel(x, y), 20))
                    if (bmp1.GetPixel(x, y) > 0 && bmp2.GetAlpha(x, y) < 100)
                    {
                        different++;
                    }
                }
                if (different > maxDiff)
                {
                    return(different + 10);
                }
            }
            return(different);
        }
        internal static int IsBitmapsAlike(Ocr.Binary.BinaryOcrBitmap bmp1, Ocr.Binary.BinaryOcrBitmap bmp2)
        {
            int different = 0;
            int maxDiff = bmp1.Width * bmp1.Height / 5;
            for (int y = 0; y < bmp1.Height; y++)
            {
                var pixel = y * bmp1.Width;
                for (int x = 0; x < bmp1.Width; x++)
                {
                    if (bmp1.GetPixel(pixel) != bmp2.GetPixel(pixel))
                    {
                        different++;
                    }

                    pixel++;
                }
                if (different > maxDiff)
                {
                    return different + 10;
                }
            }
            return different;
        }
        /// <summary>
        /// The is bitmaps alike.
        /// </summary>
        /// <param name="bmp1">
        /// The bmp 1.
        /// </param>
        /// <param name="bmp2">
        /// The bmp 2.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        internal static int IsBitmapsAlike(NikseBitmap bmp1, BinaryOcrBitmap bmp2)
        {
            int different = 0;
            int maxDiff = bmp1.Width * bmp1.Height / 5;

            for (int x = 1; x < bmp1.Width; x++)
            {
                for (int y = 1; y < bmp1.Height; y++)
                {
                    if (bmp1.GetAlpha(x, y) < 100 && bmp2.GetPixel(x, y) > 0)
                    {
                        different++;
                    }
                }

                if (different > maxDiff)
                {
                    return different + 10;
                }
            }

            return different;
        }