CaptchaRecogition.ImageProcess.GetBinaryCode C# (CSharp) Method

GetBinaryCode() public static method

获取图片特征码
public static GetBinaryCode ( Bitmap img ) : string
img System.Drawing.Bitmap
return string
        public static string GetBinaryCode(Bitmap img)
        {
            StringBuilder sb = new StringBuilder();
            int width = img.Width;
            int height = img.Height;
            BitmapData bdata = img.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly,
                PixelFormat.Format32bppRgb);
            unsafe
            {
                byte* start = (byte*)bdata.Scan0.ToPointer();
                for (int i = 0; i < height; i++)
                {
                    for (int j = 0; j < width; j++)
                    {
                        if (start[0] == 255)
                        {
                            sb.Append("0");

                        }
                        else
                        {
                            sb.Append("1");
                        }
                        start += 4;
                    }
                    start += bdata.Stride - width * 4;
                }
            }
            img.UnlockBits(bdata);
            return sb.ToString();

        }
        /// <summary>