示例#1
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("没有");
            }
        }
示例#2
0
        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);
            }
        }