Exemplo n.º 1
0
        public Image drawFacialFlandmarks(long[] IDs, int tracker, Image frameImage)
        {
            Graphics gr  = Graphics.FromImage(frameImage);
            Pen      pen = new Pen(Brushes.Red);

            pen.Width    = 5.0F;
            pen.LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel;
            for (int i = 0; i < IDs.Length; ++i)
            {
                FSDK.TFacePosition facePosition = new FSDK.TFacePosition();
                FSDK.GetTrackerFacePosition(tracker, 0, IDs[i], ref facePosition);
                FSDK.TPoint[] facialFeatures;
                FSDK.GetTrackerFacialFeatures(tracker, 0, IDs[i], out facialFeatures);
                int          left   = facePosition.xc - (int)(facePosition.w * 0.6);
                int          top    = facePosition.yc - (int)(facePosition.w * 0.5);
                StringFormat format = new StringFormat();

                for (int x = 0; x < facialFeatures.Length; x++)
                {
                    FSDK.TPoint point = facialFeatures[x];
                    gr.FillEllipse(Brushes.DarkBlue, point.x, point.y, 4, 4);

                    GuesGenderAndAge(IDs, i, tracker);
                    personRecognize(IDs, facePosition, left, top, facePosition.w, i, tracker, frameImage);
                }
            }
            return(frameImage);
        }
Exemplo n.º 2
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.listView1.SelectedIndices.Count > 0)
            {
                Image img = FaceList[listView1.SelectedIndices[0]].image.ToCLRImage();
                pictureBox1.Height = img.Height;
                pictureBox1.Width  = img.Width;
                pictureBox1.Image  = img;

                pictureBox1.Refresh();
                Graphics gr = pictureBox1.CreateGraphics();
                gr.DrawRectangle(Pens.LightGreen, FaceList[listView1.SelectedIndices[0]].FacePosition.xc - FaceList[listView1.SelectedIndices[0]].FacePosition.w / 2, FaceList[listView1.SelectedIndices[0]].FacePosition.yc - FaceList[listView1.SelectedIndices[0]].FacePosition.w / 2, FaceList[listView1.SelectedIndices[0]].FacePosition.w, FaceList[listView1.SelectedIndices[0]].FacePosition.w);

                for (int i = 0; i < 2; ++i)
                {
                    FSDK.TPoint tp = FaceList[listView1.SelectedIndices[0]].FacialFeatures[i];
                    gr.DrawEllipse(Pens.Blue, tp.x, tp.y, 3, 3);
                }
            }
        }
Exemplo n.º 3
0
 public static Point ToPoint(this FSDK.TPoint point)
 {
     return(new Point(point.x, point.y));
 }