浏览代码

Quick fix for a out of range error that could occur (#236)

This error could occur when a template has a skeleton referencing joints that are not present in template
/main
GitHub 4 年前
当前提交
23d814f5
共有 2 个文件被更改,包括 11 次插入3 次删除
  1. 2
      com.unity.perception/CHANGELOG.md
  2. 12
      com.unity.perception/Runtime/GroundTruth/Labelers/KeypointLabeler.cs

2
com.unity.perception/CHANGELOG.md


Fixed keypoints being reported in wrong locations on the first frame an object is visible.
Fixed an out of range error if a keypoint template skeleton relies on a joint that is not available.
## [0.7.0-preview.2] - 2021-02-08
### Upgrade Notes

12
com.unity.perception/Runtime/GroundTruth/Labelers/KeypointLabeler.cs


return "unset";
}
Keypoint GetKeypointForJoint(KeypointEntry entry, int joint)
{
if (joint < 0 || joint >= entry.keypoints.Length) return null;
return entry.keypoints[joint];
}
/// <inheritdoc/>
protected override void OnVisualize()
{

{
foreach (var bone in activeTemplate.skeleton)
{
var joint1 = entry.keypoints[bone.joint1];
var joint2 = entry.keypoints[bone.joint2];
var joint1 = GetKeypointForJoint(entry, bone.joint1);
var joint2 = GetKeypointForJoint(entry, bone.joint2);
if (joint1.state == 2 && joint2.state == 2)
if (joint1 != null && joint1.state == 2 && joint2 != null && joint2.state == 2)
{
VisualizationHelper.DrawLine(joint1.x, joint1.y, joint2.x, joint2.y, bone.color, 8, skeletonTexture);
}

正在加载...
取消
保存