浏览代码

Updated documentation

/main
Steven Borkman 4 年前
当前提交
fb578444
共有 3 个文件被更改,包括 96 次插入4 次删除
  1. 17
      com.unity.perception/Runtime/GroundTruth/Labelers/JointLabel.cs
  2. 35
      com.unity.perception/Runtime/GroundTruth/Labelers/KeyPointLabeler.cs
  3. 48
      com.unity.perception/Runtime/GroundTruth/Labelers/KeyPointTemplate.cs

17
com.unity.perception/Runtime/GroundTruth/Labelers/JointLabel.cs


namespace UnityEngine.Perception.GroundTruth
{
/// <summary>
/// Label to designate a custom joint/keypoint. These are needed to add body
/// parts to a humanoid model that are not contained in its <see cref="Animator"/> <see cref="Avatar"/>
/// </summary>
/// <summary>
/// Maps this joint to a joint in a <see cref="KeyPointTemplate"/>
/// </summary>
/// <summary>
/// The <see cref="KeyPointTemplate"/> that defines this joint.
/// </summary>
/// <summary>
/// The name of the joint.
/// </summary>
/// <summary>
/// List of all of the templates that this joint can be mapped to.
/// </summary>
public List<TemplateData> templateInformation;
}
}

35
com.unity.perception/Runtime/GroundTruth/Labelers/KeyPointLabeler.cs


namespace UnityEngine.Perception.GroundTruth
{
/// <summary>
/// Produces keypoint annotations for a humanoid model. This labeler supports generic
/// <see cref="KeyPointTemplate"/>. Template values are mapped to rigged
/// <see cref="Animator"/> <seealso cref="Avatar"/>. Custom joints can be
/// created by applying <see cref="JointLabel"/> to empty game objects at a body
/// part's location.
/// </summary>
/// <summary>
/// The active keypoint template. Required to annotate keypoint data.
/// </summary>
/// <inheritdoc/>
public override string description
{
get => "Produces keypoint annotations for all visible labeled objects that have a humanoid animation avatar component.";

protected override bool supportsVisualization => true;
// ReSharper disable MemberCanBePrivate.Global
/// <summary>
/// The GUID id to associate with the annotations produced by this labeler.
/// </summary>
/// <summary>
/// The <see cref="IdLabelConfig"/> which associates objects with labels.
/// </summary>
public IdLabelConfig idLabelConfig;
// ReSharper restore MemberCanBePrivate.Global

/// <inheritdoc/>
protected override void Setup()
{
if (idLabelConfig == null)

m_KeyPointEntries = new List<KeyPointEntry>();
// Texture to use in case the template does not contain a texture for the joints or the skeletal connections
/// <inheritdoc/>
protected override void OnBeginRendering()
{
var reporter = perceptionCamera.SensorHandle.ReportAnnotationAsync(m_AnnotationDefinition);

// ReSharper disable InconsistentNaming
// ReSharper disable NotAccessedField.Global
// ReSharper disable NotAccessedField.Local
public struct KeyPointEntry
struct KeyPointEntry
/// <summary>
/// The id of the labeled entity
/// </summary>
public int label_id;
public uint instance_id;
public string template_guid;

[Serializable]
public struct KeyPoint
struct KeyPoint
{
public int index;
public float x;

// ReSharper restore InconsistentNaming
// ReSharper restore NotAccessedField.Global
// ReSharper restore NotAccessedField.Local
// Converts a coordinate from world space into pixel space
Vector3 ConvertToScreenSpace(Vector3 worldLocation)
{
var pt = perceptionCamera.attachedCamera.WorldToScreenPoint(worldLocation);

void ProcessEntity(Labeling labeledEntity)
{
// Cache out the data of a labeled game object the first time we see it, this will
// save performance each frame. Also checks to see if a labeled game object can be annotated.
if (!m_KnownStatus.ContainsKey(labeledEntity.instanceId))
{
var cached = new CachedData()

GUI.color = oldColor;
}
/// <inheritdoc/>
protected override void OnVisualize()
{
var jointTexture = activeTemplate.jointTexture;

48
com.unity.perception/Runtime/GroundTruth/Labelers/KeyPointTemplate.cs


namespace UnityEngine.Perception.GroundTruth
{
/// <summary>
/// A definition of a keypoint (joint).
/// </summary>
/// <summary>
/// The name of the keypoint
/// </summary>
/// <summary>
/// Does this keypoint map directly to a <see cref="Animator"/> <see cref="Avatar"/> <see cref="HumanBodyBones"/>
/// </summary>
/// <summary>
/// The associated <see cref="HumanBodyBones"/> of the rig
/// </summary>
/// <summary>
/// The color of the keypoint in the visualization
/// </summary>
/// <summary>
/// A skeletal connection between two joints.
/// </summary>
/// <summary>
/// The first joint
/// </summary>
/// <summary>
/// The second joint
/// </summary>
/// <summary>
/// The color of the skeleton in the visualization
/// </summary>
/// <summary>
/// Template used to define the keypoints of a humanoid asset.
/// </summary>
/// <summary>
/// The <see cref="Guid"/> of the template
/// </summary>
/// <summary>
/// The name of the template
/// </summary>
/// <summary>
/// Texture to use for the visualization of the joint.
/// </summary>
/// <summary>
/// Texture to use for the visualization of the skeletal connection.
/// </summary>
/// <summary>
/// Array of <see cref="KeyPointDefinition"/> for the template.
/// </summary>
/// <summary>
/// Array of the <see cref="SkeletonDefinition"/> for the template.
/// </summary>
public SkeletonDefinition[] skeleton;
}
}
正在加载...
取消
保存