コード例 #1
0
ファイル: FaceDB.cs プロジェクト: xy19xiaoyu/BaiDuAiFaceDemo
        private void btnNewFace_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtName.Text.Trim()))
            {
                txtName.Focus();
                return;
            }

            if (string.IsNullOrEmpty(this.txtTel.Text.Trim()))
            {
                txtTel.Focus();
                return;
            }

            string userinfo = this.txtName.Text + "," + this.txtTel.Text;

            FaceHelper.AddUserFace(this.txtID.Text, userinfo, "JXGF", this.FileName);
        }
コード例 #2
0
ファイル: FaceDB.cs プロジェクト: xy19xiaoyu/BaiDuAiFaceDemo
        private void button1_Click(object sender, EventArgs e)
        {
            UserInfo user = FaceHelper.IdentifyDemo(this.FileName);

            if (user != null)
            {
                this.txtID.Text         = user.id.ToString();
                this.txtName.Text       = user.name;
                this.txtTel.Text        = user.tel;
                this.btnNewFace.Visible = false;
            }
            else
            {
                MessageBox.Show("没找到用户,请创建");
                id = id + 1;
                File.WriteAllText("num.txt", id.ToString());
                this.txtID.Text         = id.ToString();
                this.btnNewFace.Visible = true;
            }
        }
コード例 #3
0
        private void button5_Click(object sender, EventArgs e)
        {
            JObject result = FaceHelper.Detect(this.textBox2.Text.Trim());

            if (result.Value <int>("result_num") > 0)
            {
                foreach (var tmpResult in result["result"])
                {
                    var location = tmpResult["location"];
                    using (Graphics g = Graphics.FromImage(Map2))
                    {
                        g.DrawRectangle(new Pen(Brushes.Blue, 4), location.Value <int>("left"), location.Value <int>("top"), location.Value <int>("width"), location.Value <int>("height"));
                    }
                }
                pictureBox2.Image = Map2;
            }
            else
            {
                MessageBox.Show("没有");
            }
        }
コード例 #4
0
ファイル: FaceDB.cs プロジェクト: xy19xiaoyu/BaiDuAiFaceDemo
        private bool CheckFace()
        {
            JObject result = FaceHelper.Detect(FileName);

            if (result.Value <int>("result_num") > 0)
            {
                foreach (var tmpResult in result["result"])
                {
                    var location = tmpResult["location"];
                    using (Graphics g = Graphics.FromImage(Map))
                    {
                        g.DrawRectangle(new Pen(Brushes.Blue, 4), location.Value <int>("left"), location.Value <int>("top"), location.Value <int>("width"), location.Value <int>("height"));
                    }
                }
                pictureBox1.Image = Map;
                return(true);
            }
            else
            {
                MessageBox.Show("没有发现面部特征");
                return(false);
            }
        }
コード例 #5
0
        private void button3_Click(object sender, EventArgs e)
        {
            int score = FaceHelper.Match(textBox1.Text, textBox2.Text);

            MessageBox.Show("相似分:" + score);
        }