Esempio n. 1
0
        private void toolStripButton_clip_output_Click(object sender, EventArgs e)
        {
            if (this.pictureBox_clip.Image == null)
            {
                MessageBox.Show(this, "没有可以输出的图像");
                return;
            }

            using (Bitmap bitmap = new Bitmap(this.pictureBox_clip.Image))
            {
                this.Image = AForgeImageUtil.Clip(bitmap,
                                                  this.pictureBox_clip.GetCorners());
            }

            this.tabControl_main.SelectedTab = this.tabPage_result;
        }
Esempio n. 2
0
        void DetectEdge()
        {
            if (this.pictureBox_clip.Image == null)
            {
                return;
            }

            Cursor old_cursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;
            try
            {
                double    angle = 0;
                Rectangle rect;
                using (Bitmap bitmap = new Bitmap(this.pictureBox_clip.Image))
                {
                    // this.pictureBox1.Image = ImageUtil.AforgeAutoCrop(bitmap);
                    DetectBorderParam param = new DetectBorderParam(bitmap);
                    bool bRet = AForgeImageUtil.GetSkewParam(bitmap,
                                                             param,
                                                             out angle,
                                                             out rect);
                    if (bRet == false)
                    {
                        MessageBox.Show(this, "探测边框失败");
                        return;
                    }
                }

#if NO
                using (Bitmap bitmap = new Bitmap(this.pictureBox1.Image))
                {
                    this.pictureBox1.Image = ImageUtil.Apply(bitmap,
                                                             angle,
                                                             rect);
                }
#endif

                List <Point> points = this.pictureBox_clip.ToPoints((float)angle, rect);
                this.pictureBox_clip.SetPoints(points);
            }
            finally
            {
                this.Cursor = old_cursor;
            }
        }
Esempio n. 3
0
        private void toolStripButton_getAndClose_Click(object sender, EventArgs e)
        {
            if (this.tabControl_main.SelectedTab == this.tabPage_preview)
            {
                this.Image = this.qrRecognitionControl1.Image;
            }
            else if (this.tabControl_main.SelectedTab == this.tabPage_clip)
            {
                using (Bitmap bitmap = new Bitmap(this.pictureBox_clip.Image))
                {
                    this.Image = AForgeImageUtil.Clip(bitmap,
                                                      this.pictureBox_clip.GetCorners());
                }
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }