最好能实际给出代码

解决方案 »

  1.   

    转换为RGB数据流进行比较把..
      

  2.   


      private bool ImageEquals(Bitmap bmpOne,Bitmap bmpTwo)
            {
                
                for (int i = 0; i < bmpOne.Width; i++)
    {
        for (int j = 0; j < bmpOne.Height; j++)
        {
                        if (bmpOne.GetPixel(i, j) != bmpTwo.GetPixel(i, j))
                            return false;
        }
    }
                return true;
            }
      

  3.   

    private bool ScanBitmap(Bitmap SourceBitmap, Bitmap TargetBitmap)
    {
    BitmapData bmpDATA1 = new BitmapData();
    SourceBitmap.LockBits(new Rectangle(0, 0, SourceBitmap.Width, SourceBitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
    BitmapData bmpDATA2 = new BitmapData();
    TargetBitmap.LockBits(new Rectangle(0, 0, TargetBitmap.Width, TargetBitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
    byte[] BTS1 = new byte[bmpDATA1.Stride * bmpDATA1.Height + 1];
    byte[] BTS2 = new byte[bmpDATA2.Stride * bmpDATA2.Height + 1];
    System.Runtime.InteropServices.Marshal.Copy(bmpDATA1.Scan0, BTS1, 0, BTS1.Length);
    System.Runtime.InteropServices.Marshal.Copy(bmpDATA2.Scan0, BTS2, 0, BTS2.Length);
    if (BTS1.Length != BTS2.Length) {
    return false;
    SourceBitmap.UnlockBits(bmpDATA1);
    SourceBitmap.UnlockBits(bmpDATA2);
    Interaction.MsgBox("两图不同!");
    return;
    }
    for (int I = 0; I <= BTS1.Length - 1; I += 4) {
    if (BTS1[I] != BTS2[I] || BTS1[I + 1] != BTS1[I + 1] || BTS1[I + 2] != BTS1[I + 2] || BTS1[I + 3] != BTS1[I + 3]) {
    return false;
    SourceBitmap.UnlockBits(bmpDATA1);
    SourceBitmap.UnlockBits(bmpDATA2);
    Interaction.MsgBox("两图不同!");
    return;
    }
    }
    return true;
    SourceBitmap.UnlockBits(bmpDATA1);
    SourceBitmap.UnlockBits(bmpDATA2);
    Interaction.MsgBox("两图完全一样");
    }//参数说明: 
    //SourceBitmap:要比较的源图 
    //TargetBitmap:要比较的条件图
      

  4.   

    http://topic.csdn.net/u/20081230/12/6c3e1e10-8c62-49dd-b899-9d51abc4f02c.html
      

  5.   


    如要定位像素位置将i,j换个位置
    if (bmpOne.GetPixel(j, i) != bmpTwo.GetPixel(j, i))
                            return false;
      

  6.   

     Bitmap Image_One = new Bitmap(@"C:\Documents and Settings\helang\桌面    \ImageEquals\one.jpg", true);
            Bitmap Image_two = new Bitmap(@"C:\Documents and Settings\helang\桌面\ImageEquals\two.jpg", true);        private bool ImageEquals(Bitmap bmpOne, Bitmap bmpTwo)
            {
                for (int i = 0; i < bmpOne.Width; i++)
                {
                    for (int j = 0; j < bmpOne.Height; j++)
                    {
                        if (bmpOne.GetPixel(i, j) != bmpTwo.GetPixel(i, j))
                            return false;
                    } 
                }
                return true;
            }        private void button1_Click(object sender, EventArgs e)
            {
                if (ImageEquals(Image_One, Image_two))
                {
                    MessageBox.Show("完全一样!");
                }
                else 
                {
                    MessageBox.Show("不同!");
                }
            }
      

  7.   

    将两张图片转换成 int[,,],然后相减,
    在另一个数组里标识出非0的区域即可