我正在使用kinect 2.0传感器进行项目。
在用户上绘制骨架非常简单,但是如何仅绘制某些零件,甚至绘制整个骨架,但如果某些身体部位(脚,腿......)超出相机视野范围,那么如何不画它们?
我使用的是Vitruvius库和标准的kinect 2.0库。
//depth
using (var depthFrame = reference.DepthFrameReference.AcquireFrame())
//Body index
using (var bodyIndexFrame = reference.BodyIndexFrameReference.AcquireFrame())
// Body
using (var bodyframe = reference.BodyFrameReference.AcquireFrame())
{
var bodies = bodyframe.Bodies();
...
_playersController.Update(bodies);
...
Body body = bodies.Closest();
viewer.Clear();
viewer.DrawBody(body, 10.0, Brushes.Green, 10.0, Brushes.Green);
...
}
这就是我画我的身体的方式,而且它有效。如果我去DrawBody()
'定义,我明白了:
public void DrawBody(Body body, double jointRadius, Brush jointBrush, double boneThickness, Brush boneBrush);
如果我进入身体定义(所以我可以选择要绘制的关节),我会发现:
//
// Summary:
// Represents a single body.
public sealed class Body
{
~Body();
//
// Summary:
// Gets the number of joints in a body.
public static int JointCount { get; }
//
// Summary:
// Gets the lean vector of the body.
public PointF Lean { get; }
//
// Summary:
// Gets whether or not the body is restricted.
public bool IsRestricted { get; }
//
// Summary:
// Gets whether or not the body is tracked.
public bool IsTracked { get; }
//
// Summary:
// Gets the tracking ID for the body.
public ulong TrackingId { get; }
//
// Summary:
// Gets the edges of the field of view that clip the body.
public FrameEdges ClippedEdges { get; }
//
// Summary:
// Gets the status of the body's engagement. This API is not implemented in the
// Kinect for Windows v2 SDK. It is included to support cross-compilation with the
// Xbox SDK.
[Obsolete("This API has been replaced by Microsoft.Kinect.Face", true)]
public DetectionResult Engaged { get; }
//
// Summary:
// Gets the joint positions of the body.
public IReadOnlyDictionary<JointType, Joint> Joints { get; }
//
// Summary:
// Gets the status of the body's right hand state.
public HandState HandRightState { get; }
//
// Summary:
// Gets the confidence of the body's left hand state.
public TrackingConfidence HandLeftConfidence { get; }
//
// Summary:
// Gets the status of the body's left hand state.
public HandState HandLeftState { get; }
//
// Summary:
// Gets the status of the body's possible appearance characteristics. This API is
// not implemented in the Kinect for Windows v2 SDK and will always return null.
// It is included to support cross-compilation with the Xbox SDK.
[Obsolete("This API has been replaced by Microsoft.Kinect.Face", true)]
public IReadOnlyDictionary<Appearance, DetectionResult> Appearance { get; }
//
// Summary:
// Gets the status of the body's possible activities. This API is not implemented
// in the Kinect for Windows v2 SDK and will always return null. It is included
// to support cross-compilation with the Xbox SDK.
[Obsolete("This API has been replaced by Microsoft.Kinect.Face", true)]
public IReadOnlyDictionary<Activity, DetectionResult> Activities { get; }
//
// Summary:
// Gets the status of the body's possible expressions. This API is not implemented
// in the Kinect for Windows v2 SDK and will always return null. It is included
// to support cross-compilation with the Xbox SDK.
[Obsolete("This API has been replaced by Microsoft.Kinect.Face", true)]
public IReadOnlyDictionary<Expression, DetectionResult> Expressions { get; }
//
// Summary:
// Gets the joint orientations of the body.
public IReadOnlyDictionary<JointType, JointOrientation> JointOrientations { get; }
//
// Summary:
// Gets the tracking state for the body lean.
public TrackingState LeanTrackingState { get; }
//
// Summary:
// Gets the confidence of the body's right hand state.
public TrackingConfidence HandRightConfidence { get; }
}
这真的无益。它在哪里画什么?我甚至可以只绘制某些部分吗?我之前看到过只吸引上半身的人,但对他是怎么做的却没有任何解释。
答案 0 :(得分:0)