Example #1
0
        public static openposeKeyPoint fromString2D_coco(string line)
        {
            openposeKeyPoint rtn = new openposeKeyPoint();

            string[] lines = line.Trim().Split(',');
            float    temp;

            try
            {
                if (!float.TryParse(lines[0], out temp))
                {
                    throw new Exception("Invalid point x value '" + line + "'");
                }
                rtn.x = temp;

                if (!float.TryParse(lines[1], out temp))
                {
                    throw new Exception("Invalid point y value '" + line + "'");
                }
                rtn.y = temp;

                if (!float.TryParse(lines[2], out temp))
                {
                    throw new Exception("Invalid point p-value '" + line + "'");
                }
                rtn.pValue = temp;
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to parse point record '" + line + "' : " + ex.Message);
            }

            return(rtn);
        }
Example #2
0
 //draw a point circle
 private static void drawPoint(Graphics gp, Brush bs, float radius, openposeKeyPoint pt, float thr = 0.05F, float wd = float.NaN, float ht = float.NaN)
 {
     if (pt.pValue > thr)
     {
         if (float.IsNaN(wd))
         {
             gp.FillEllipse(bs, pt.x - radius, pt.y - radius, radius + radius, radius + radius);
         }
         else
         {
             gp.FillEllipse(bs, (pt.x * wd) - radius, (pt.y * ht) - radius, radius + radius, radius + radius);
         }
     }
 }
Example #3
0
 private static void drawConnect(Graphics gp, Pen p, openposeKeyPoint pt1, openposeKeyPoint pt2, float thr = 0.05F, float wd = float.NaN, float ht = float.NaN)
 {
     if (pt1.pValue > thr && pt2.pValue > thr)
     {
         if (float.IsNaN(wd))
         {
             gp.DrawLine(p, pt1.x, pt1.y, pt2.x, pt2.y);
         }
         else
         {
             gp.DrawLine(p, pt1.x * wd, pt1.y * ht, pt2.x * wd, pt2.y * ht);
         }
     }
 }