Software Archive
Read-only legacy content

Retrieve the position of specific face landmark

Majid_N_
Beginner
321 Views

Hi there,

i just want to know that how can I return the x,y position of the specific face land mark from the RSDK sample face tracking. In the following function we can see that we have access to all face land marks but how can I show only nose points (30,31,32) and not others.

Thanks

Majid

public void DrawLandmark(PXCMFaceData.Face face)
        {
            Debug.Assert(face != null);
            PXCMFaceData.LandmarksData landmarks = face.QueryLandmarks();
            if (m_bitmap == null || !Landmarks.Checked || landmarks == null) return;

            lock (m_bitmapLock)
            {
                using (Graphics graphics = Graphics.FromImage(m_bitmap))
                using (var brush = new SolidBrush(Color.White))
                using (var lowConfidenceBrush = new SolidBrush(Color.Red))
                using (var font = new Font(FontFamily.GenericMonospace, m_faceTextOrganizer.FontSize, FontStyle.Bold))
                {
                    PXCMFaceData.LandmarkPoint[] points;
                    bool res = landmarks.QueryPoints(out points);
                    Debug.Assert(res);

                    var point = new PointF();

                    foreach (PXCMFaceData.LandmarkPoint landmark in points)
                    {
                        point.X = landmark.image.x;
                        point.Y = landmark.image.y;

                        if (landmark.confidenceImage == 0)
                            graphics.DrawString("x", font, lowConfidenceBrush, point);
                        else
                            graphics.DrawString("•" + point.X, font, brush, point);
                    }
                   }
            }
        }

0 Kudos
1 Reply
Majid_N_
Beginner
321 Views

Its an update.

Finally I found the solution. I just write the solution for other users if they need.

 

                    var point2 = new PointF();
                    PXCMFaceData.LandmarkPoint landmark2 = points[31];
                    point2.X = landmark2.image.x;
                    point2.Y = landmark2.image.y;
                    if (landmark2.confidenceImage == 0)
                        graphics.DrawString("x", font, lowConfidenceBrush, point2);
                    else
                        graphics.DrawString("@", font, brush, point2);
 

 

Majid

0 Kudos
Reply