日期:2014-05-17 浏览次数:20868 次
public Point GetImageContains(Bitmap p_SourceBitmap, Bitmap p_PartBitmap, int p_Float,int pointnums)
{
Point P_res = new Point(-1, -1);
int Height_S = p_SourceBitmap.Height;
int Width_S = p_SourceBitmap.Width;
int Height_P = p_PartBitmap.Height;
int Width_P = p_PartBitmap.Width;
//原图转换成 byte[]
BitmapData _SourceData = p_SourceBitmap.LockBits(new Rectangle(0, 0, p_SourceBitmap.Width, p_SourceBitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
byte[] DataSource = new byte[_SourceData.Stride * p_SourceBitmap.Height];
Marshal.Copy(_SourceData.Scan0, DataSource, 0, DataSource.Length);
p_SourceBitmap.UnlockBits(_SourceData);
//子图转换成 byte[]
BitmapData _PartData = p_PartBitmap.LockBits(new Rectangle(0, 0, p_PartBitmap.Width, p_PartBitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
byte[] DataPart = new byte[_PartData.Stride * p_PartBitmap.Height];
Marshal.Copy(_PartData.Scan0, DataPart, 0, DataPart.Length);
p_PartBitmap.UnlockBits(_PartData);
int index=0;
for (int b = 0; b < Height_S - Height_P; b++)
for (int a = 0; a < Width_S - Width_P; a++)