Пример #1
0
        private void but_stereo_Click(object sender, EventArgs e)
        {
            Bitmap c;
            Bitmap d;

            lock (this.colorBitmap)
            {
                lock (this.depthBitmap)
                {
                    c = this.colorBitmap.Clone(
                        new Rectangle(new Point(0, 0), this.colorBitmap.Size),
                        PixelFormat.Format24bppRgb);
                    d = this.depthBitmap.Clone(
                        new Rectangle(new Point(0, 0), this.depthBitmap.Size),
                        PixelFormat.Format24bppRgb);

                    if (this.strggen3 == null)
                    {
                        this.strggen3 = new c_3DGenerator();
                        this.strggen3.AnaglyphComplete     += this.gen3_StereoComplete;
                        this.strggen3.StereoscopicComplete += this.gen3_StereoComplete;
                    }

                    this.l_save.Enabled                = false;
                    this.l_saveanag.Enabled            = false;
                    this.but_anag.Enabled              = false;
                    this.but_stereo.Enabled            = false;
                    this.strggen3.SwapRightLeft        = this.cb_swap.Checked;
                    this.strggen3.Smoothing            = this.cb_smoothing.Checked;
                    this.strggen3.MaxPixelDisplacement = (int)this.nud_maxdisp.Value;

                    // if (lbl_registration.Visible)
                    // {
                    // d = this.DepthFix(this.depthBitmap);
                    // }
                    if (this.colorBitmap.Size.Equals(new Size(1280, 1024)) ||
                        this.colorBitmap.Size.Equals(new Size(1280, 960)))
                    {
                        c = this.colorBitmap.Clone(
                            new Rectangle(0, this.isUse960asHD ? 0 : 32, 1280, 960),
                            PixelFormat.Format24bppRgb);
                        d = new Bitmap(d, 1280, 960);
                    }
                    else if (!this.colorBitmap.Size.Equals(this.depthBitmap.Size))
                    {
                        c = new Bitmap(this.colorBitmap, 640, 480);
                        d = new Bitmap(d, 640, 480);
                    }
                }
            }

            Bitmap p = d.Clone(new Rectangle(new Point(0, 0), d.Size), PixelFormat.Format24bppRgb);

            this.strggen3.GenerateAnaglyphAsync(p, d, new[] { c, d });
        }
Пример #2
0
        private void but_anag_Click(object sender, EventArgs e)
        {
            Bitmap c;
            Bitmap d;
            lock (this.colorBitmap)
            {
                lock (this.depthBitmap)
                {
                    c = this.colorBitmap.Clone(
                        new Rectangle(new Point(0, 0), this.colorBitmap.Size),
                        PixelFormat.Format24bppRgb);
                    d = this.depthBitmap.Clone(
                        new Rectangle(new Point(0, 0), this.depthBitmap.Size),
                        PixelFormat.Format24bppRgb);

                    if (this.anaggen3 == null)
                    {
                        this.anaggen3 = new c_3DGenerator();
                        this.anaggen3.AnaglyphComplete += this.gen3_AnagComplete;
                    }

                    this.but_anag.Enabled = false;
                    this.but_stereo.Enabled = false;
                    this.cb_devices.Enabled = false;
                    this.l_save.Enabled = false;
                    this.l_saveanag.Enabled = false;
                    this.anaggen3.SwapRightLeft = this.cb_swap.Checked;
                    this.anaggen3.Smoothing = this.cb_smoothing.Checked;
                    this.anaggen3.MaxPixelDisplacement = (int)this.nud_maxdisp.Value;

                    // if (lbl_registration.Visible)
                    // {
                    // d = this.DepthFix(this.depthBitmap);
                    // }
                    if (this.colorBitmap.Size.Equals(new Size(1280, 1024))
                        || this.colorBitmap.Size.Equals(new Size(1280, 960)))
                    {
                        c = this.colorBitmap.Clone(
                            new Rectangle(0, this.isUse960asHD ? 0 : 32, 1280, 960),
                            PixelFormat.Format24bppRgb);
                        d = new Bitmap(d, 1280, 960);
                    }
                    else if (!this.colorBitmap.Size.Equals(this.depthBitmap.Size))
                    {
                        c = new Bitmap(this.colorBitmap, 640, 480);
                        d = new Bitmap(d, 640, 480);
                    }
                }
            }

            Bitmap p = d.Clone(new Rectangle(new Point(0, 0), d.Size), PixelFormat.Format24bppRgb);
            this.anaggen3.GenerateAnaglyphAsync(p, d, new[] { c, d });
        }