sift算法搭建(上半部,四,第一组第一层dog金字塔生成,c#实现)

我们直接上代码,这更能说明问题:

 int[] oct1dog1layer512 = new int[512 * 512];
        int[] oct1dog2layer512 = new int[512 * 512];
        int[] oct1dog3layer512 = new int[512 * 512];
        int[] oct1dog4layer512 = new int[512 * 512];
        int[] oct1dog5layer512 = new int[512 * 512];
        private void button21_Click(object sender, EventArgs e)
        {
            byte[] dog1layer512 = new byte[512 * 512];//第一组第一层dog金子塔
            for (int i = 0; i < 512 * 512; i++)
            {//
                int temp = oct1globbuffer2layer[i] - oct1globbuffer1layer[i];//高斯金字塔2层-1层
              //  temp =Math.Abs(temp);
                oct1dog1layer512[i] = temp;//第一组第一层dog金子塔
                temp *= 20;//不如此,一团黑
                dog1layer512[i] = temp > 0 ? (byte)temp : (byte)Math.Abs(temp);//用来界面显示的第一组第一层dog金子塔
               // dog1layer512[i] =  (byte)temp ;
            }

            int ww = 512;
            int hh = 512;
            ///测试8位显示
            Bitmap cutPic88 = new Bitmap(ww, hh, PixelFormat.Format8bppIndexed);
            System.Drawing.Imaging.ColorPalette cp = cutPic88.Palette;
            for (int i = 0; i < 256; i++)
            {
                cp.Entries[i] = Color.FromArgb(255, i, i, i);
            }
            cutPic88.Palette = cp;
            BitmapData _cutPic8 = cutPic88.LockBits(new Rectangle(0, 0, ww, hh), ImageLockMode.ReadWrite,
                                                 cutPic88.PixelFormat);
            IntPtr ptr00 = _cutPic8.Scan0;//得到首地址                   
            //把cutvalues数组给ptr
            System.Runtime.InteropServices.Marshal.Copy(dog1layer512, 0, ptr00, ww * hh);
            cutPic88.UnlockBits(_cutPic8);
            pictureBox6.Image = cutPic88;//pictureBox显示dog金字塔
        }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值