当前位置:编程学习 > C#/ASP.NET >>

请求的范围扩展超过了数组的结尾。 大家能说说怎么回事吗

       Rectangle rect_Wm = new Rectangle(0, 0, bmp_Wm.Width, bmp_Wm.Height);//新建二维码位图
                    System.Drawing.Imaging.BitmapData bmpData_Wm = bmp_Wm.LockBits(rect_Wm,
                          System.Drawing.Imaging.ImageLockMode.ReadWrite, bmp_Wm.PixelFormat);
                    IntPtr ptr_Wm = bmpData_Wm.Scan0;

                    //int bytes_Wm = bmp_Wm.Width * bmp_Wm.Height;
                    int bytes_Wm = bmp_IFFT2.Width * bmp_IFFT2.Height;


                    byte[] grayValues_Wm = new byte[bytes_Wm];
                    Complex[] freDom_Wm = new Complex[bytes_Wm];
                    byte[] tempArray_Wm = new byte[bytes_Wm];

                    double ic = 100;

                    int wmwidth = bmp_Wm.Width;
                    int wmheight = bmp_Wm.Height;

                    for (int i = bmp_IFFT2.Width / 2 - bmp_Wm.Width / 2; i < bmp_IFFT2.Width + bmp_IFFT2.Width;i++ )
                    {
                        for (int j = bmp_IFFT2.Height/2-bmp_Wm.Height/2; j < bmp_IFFT2.Height/2+bmp_Wm.Height/2; j++)
                        {

                            freDom_Wm[(i - (bmp_IFFT2.Width/ 2 - wmwidth / 2)) * 128+ j - (bmp_IFFT2.Height / 2 - wmheight / 2)]
                                = ic * freDom[(i - (bmp_IFFT2.Width / 2 - wmwidth / 2)) * 128 + j - (bmp_IFFT2.Height / 2 - wmheight / 2)];
                        }
                    }

                    tempArray_Wm = idft2(freDom_Wm, bmp_Wm.Width, bmp_Wm.Height, true);
                    grayValues_Wm = (byte[])tempArray_Wm.Clone();
              出错: System.Runtime.InteropServices.Marshal.Copy(grayValues_Wm, 0, ptr_Wm, bytes_Wm);
                    bmp_Wm.UnlockBits(bmpData_Wm);
                   //mp_Image.UnlockBits(bmpData);

                    //bmp_Wm.Palette = bmp_Image.Palette;
                    pictureBox1.Image = bmp_Wm;
                    tabControl1.SelectedIndex = 4;


//断点调试的时候 byte[] grayValues_Wm 大小为:28560
                             bytes_Wm 大小为:262144

为什么会报这样的错啊 ,要怎么改呢,那里可能出问题了呢
                  --------------------编程问答--------------------
引用楼主 anselm90 的回复:
Rectangle rect_Wm = new Rectangle(0, 0, bmp_Wm.Width, bmp_Wm.Height);//新建二维码位图
  System.Drawing.Imaging.BitmapData bmpData_Wm = bmp_Wm.LockBits(rect_Wm,
  System.Drawing.Imaging.ImageLockMode.ReadWr……


你这是要干什么? 灰度图?黑白图? --------------------编程问答-------------------- 我是想把含有水印的图像中的二维码提取出来 --------------------编程问答--------------------
引用 2 楼 anselm90 的回复:
我是想把含有水印的图像中的二维码提取出来


发一个图片样例来看看,给你参考一下如何提取.

--------------------编程问答-------------------- 含水印图片:/upload/20131225/6647063_1305978577HQ05.gif

嵌入的水印:http://hi.csdn.net/attachment/201105/21/6647063_1305978715L4wS.jpg

现在想把嵌入的水印提取出来
谢谢指教!
--------------------编程问答-------------------- 嵌入的水印:

现在想把嵌入的水印提取出来
谢谢指教!
--------------------编程问答--------------------  嵌入水印后的图像:

补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,