private static AbstractDrawing CreateDrawing(Metadata metadata, long timestamp, OpenPosePerson person) { // We only support files created using the BODY_25 model, not COCO or MPI. if (person.pose_keypoints_2d != null && person.pose_keypoints_2d.Count != 75) { return(null); } string toolName = "OpenPoseBody25"; DrawingToolGenericPosture tool = ToolManager.Tools[toolName] as DrawingToolGenericPosture; if (tool == null) { return(null); } GenericPosture posture = GenericPostureManager.Instanciate(tool.ToolId, true); ParsePosture(posture, person); DrawingGenericPosture drawing = new DrawingGenericPosture(tool.ToolId, PointF.Empty, posture, timestamp, metadata.AverageTimeStampsPerFrame, ToolManager.GetStylePreset(toolName)); drawing.Name = "OpenPose"; // Disable onion skinning. drawing.InfosFading.UseDefault = false; drawing.InfosFading.ReferenceTimestamp = timestamp; drawing.InfosFading.AverageTimeStampsPerFrame = metadata.AverageTimeStampsPerFrame; drawing.InfosFading.AlwaysVisible = false; drawing.InfosFading.OpaqueFrames = 1; drawing.InfosFading.FadingFrames = 0; return(drawing); }
private static void Initialize() { files = new Dictionary <Guid, string>(); tools = new List <DrawingToolGenericPosture>(); if (!Directory.Exists(Software.CustomToolsDirectory)) { return; } string[] fileList = Directory.GetFiles(Software.CustomToolsDirectory); Array.Sort(fileList, new AlphanumComparator()); foreach (string f in fileList) { if (!Path.GetExtension(f).ToLower().Equals(".xml")) { continue; } // Extract icon and name. GenericPosture posture = new GenericPosture(f, true, false); if (posture == null || posture.Id == Guid.Empty) { continue; } files[posture.Id] = f; DrawingToolGenericPosture tool = new DrawingToolGenericPosture(); tool.SetInfo(posture); tools.Add(tool); } initialized = true; }