Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            // 将图片显示到控件
            string filepath = BaseCommon.SelectFile();

            if (String.IsNullOrEmpty(filepath))
            {
                return;
            }

            if (_imageOr != null)
            {
                _imageOr.Dispose();
            }
            _imageOr          = new Bitmap(filepath);
            pictureBox1.Image = new Bitmap(_imageOr, pictureBox1.Width, pictureBox1.Height);
        }
Esempio n. 2
0
        private void VideoImgSearch_Load(object sender, EventArgs e)
        {
            this.lstSearch.ThumbnailSize = new Size(130, 138);
            this.lstSearch.SetRenderer(new ImageListViewRenderers.XPRenderer());

            this.txtScore.Text    = _AlertScore.ToString();
            this.btnSearch.Click += delegate
            {
                if (m_searchCondition != null)
                {
                    m_searchCondition.Dispose();
                }

                Image searchImg = (Image)this.pictureBox1.Image.Clone();
                m_searchCondition = new SearchCondition("FaceTest", searchImg);

                this.lstSearch.SuspendLayout();
                this.lstSearch.Items.Clear();
                // Resume layout logic.
                this.lstSearch.ResumeLayout(true);

                int lret = SearchImage();
                if (lret == -1)
                {
                    MessageBox.Show("人脸图像搜索出现异常!", "提示");
                }
                else if (lret == -2)
                {
                    MessageBox.Show("人脸图像检测出现异常!", "提示");
                }
                else if (lret == -3)
                {
                    MessageBox.Show("人脸图像没有人脸!", "提示");
                }
                else if (lret == -4)
                {
                    MessageBox.Show("没有符合结果!", "提示");
                }
            };

            this.btnSelect.Click += delegate
            {
                string selFile = BaseCommon.SelectFile();
                if (string.IsNullOrEmpty(selFile))
                {
                    return;
                }

                if (this.pictureBox1.Image != null)
                {
                    this.pictureBox1.Image.Dispose();
                }

                Image img = Image.FromFile(selFile);
                this.pictureBox1.Image = img;
            };

            this.btnAddLibrary.Click += delegate
            {
                string number     = ConvertHelper.DateTimeToStamp().ToString();
                byte[] imgdisplay = ImageHelper.BitmapToByteArray(this.pictureBox1.Image);

                PersonManager frm = new PersonManager(imgdisplay, number);
                frm.ShowDialog();
            };
        }