Пример #1
0
        private void btLoadPicture_Click(object sender, EventArgs e)
        {
            ControlBox = false;
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Images|*.jpg;*.bmp;*.png;*.jpeg";
            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            try
            {
                Bitmap source = new Bitmap(openFileDialog.FileName);
                pictureEdit1.Image = source;
                Image    image    = source.ConvertFrom();
                FaceInfo faceInfo = MainForm.Engine.DetectMaxFace(image, null);
                Cursor = Cursors.Default;
                if (faceInfo == null)
                {
                    int num = (int)XtraMessageBox.Show(Messages.NoFaceWasFound, Messages.Message, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            catch (Exception ex)
            {
                int num = (int)XtraMessageBox.Show(ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
Пример #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            Image    image1 = ((Bitmap)pictureBox1.Image).ConvertFrom();
            Image    image2 = ((Bitmap)pictureBox2.Image).ConvertFrom();
            FaceInfo face1  = MainForm.Engine.DetectMaxFace(image1, null);
            FaceInfo face2  = MainForm.Engine.DetectMaxFace(image2, null);

            byte[] t1 = face1 != null?MainForm.Engine.ExtractTemplate(image1, face1) : null;

            byte[] t2 = face2 != null?MainForm.Engine.ExtractTemplate(image2, face2) : null;

            label1.Text = t1 == null || t2 == null?double.NaN.ToString(CultureInfo.CurrentCulture) : MainForm.Engine.Verify(t1, t2).ToString(CultureInfo.CurrentCulture);
        }
Пример #3
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            if (pictureEdit1.Image == null)
            {
                return;
            }
            foreach (DataRow dataRow in (InternalDataCollectionBase)_mainTable.Rows)
            {
                try
                {
                    ((System.Drawing.Image)dataRow["Image"]).Dispose();
                }
                catch
                {
                }
            }
            _mainTable.Rows.Clear();
            Image    image = ((Bitmap)pictureEdit1.Image).ConvertFrom();
            FaceInfo face  = MainForm.Engine.DetectMaxFace(image, null);

            if (face != null)
            {
                foreach (BcIdentificationServer identificationServer in BcIdentificationServer.LoadAll())
                {
                    try
                    {
                        byte[]                     template                   = MainForm.Engine.ExtractTemplate(image, face);
                        BcServerSettings           bcServerSettings           = BcServerSettings.Load();
                        IdentificationServerClient identificationServerClient = new IdentificationServerClient(new InstanceContext(_client));
                        identificationServerClient.Endpoint.Address = new EndpointAddress("net.tcp://" + (object)bcServerSettings.Ip + ":" + (string)(object)bcServerSettings.Port + "/FaceIdentification/IdentificationServer");
                        identificationServerClient.Open();
                        List <Guid> list   = new List <Guid>();
                        long        dtFrom = 0;
                        if (this.dtFrom.Text != "")
                        {
                            dtFrom = this.dtFrom.DateTime.Date.Ticks;
                        }
                        long dtBefore = 0;
                        if (this.dtBefore.Text != "")
                        {
                            dtBefore = this.dtBefore.DateTime.Date.Ticks;
                        }
                        if (template != null)
                        {
                            identificationServerClient.DbSearch((int)spinEdit1.Value, Convert.ToSingle(tbScore.Text), dtFrom, dtBefore, cbSex.SelectedIndex, template);
                            _startDate = DateTime.Now;
                            marqueeProgressBarControl1.Visible = true;
                            _maintimer.Enabled = true;
                            break;
                        }
                        int num = (int)XtraMessageBox.Show(Messages.Error, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    catch (Exception ex)
                    {
                        int num = (int)XtraMessageBox.Show(ex.Message, Messages.IdentificationServerUnavailble, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            else
            {
                int num1 = (int)XtraMessageBox.Show(Messages.NoFaceWasFound, Messages.Message, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }