浏览代码

renamed in tests

/main
Mohsen Kamalzadeh 4 年前
当前提交
f8af1929
共有 1 个文件被更改,包括 22 次插入22 次删除
  1. 44
      com.unity.perception/Tests/Runtime/GroundTruthTests/KeyPointGroundTruthTests.cs

44
com.unity.perception/Tests/Runtime/GroundTruthTests/KeyPointGroundTruthTests.cs


[TestFixture]
public class KeyPointGroundTruthTests : GroundTruthTestBase
{
static GameObject SetupCamera(IdLabelConfig config, KeyPointTemplate template, Action<List<KeyPointLabeler.KeyPointEntry>> computeListener)
static GameObject SetupCamera(IdLabelConfig config, KeypointTemplate template, Action<List<KeypointLabeler.KeypointEntry>> computeListener)
{
var cameraObject = new GameObject();
cameraObject.SetActive(false);

var perceptionCamera = cameraObject.AddComponent<PerceptionCamera>();
perceptionCamera.captureRgbImages = false;
var keyPointLabeler = new KeyPointLabeler(config, template);
var keyPointLabeler = new KeypointLabeler(config, template);
keyPointLabeler.KeyPointsComputed += computeListener;
keyPointLabeler.KeypointsComputed += computeListener;
perceptionCamera.AddLabeler(keyPointLabeler);

static KeyPointTemplate CreateTestTemplate(Guid guid, string label)
static KeypointTemplate CreateTestTemplate(Guid guid, string label)
var keyPoints = new[]
var keypoints = new[]
new KeyPointDefinition
new KeypointDefinition
new KeyPointDefinition
new KeypointDefinition
new KeyPointDefinition
new KeypointDefinition
new KeyPointDefinition
new KeypointDefinition
new KeyPointDefinition
new KeypointDefinition
new KeyPointDefinition
new KeypointDefinition
new KeyPointDefinition
new KeypointDefinition
new KeyPointDefinition
new KeypointDefinition
new KeyPointDefinition
new KeypointDefinition
{
label = "Center",
associateToRig = false,

},
};
var template = ScriptableObject.CreateInstance<KeyPointTemplate>();
var template = ScriptableObject.CreateInstance<KeypointTemplate>();
template.keyPoints = keyPoints;
template.keypoints = keypoints;
template.skeleton = skeleton;
return template;

Assert.AreEqual(template.templateName, label);
Assert.IsNull(template.jointTexture);
Assert.IsNull(template.skeletonTexture);
Assert.IsNotNull(template.keyPoints);
Assert.IsNotNull(template.keypoints);
Assert.AreEqual(template.keyPoints.Length, 9);
Assert.AreEqual(template.keypoints.Length, 9);
var k0 = template.keyPoints[0];
var k0 = template.keypoints[0];
Assert.NotNull(k0);
Assert.AreEqual(k0.label, "FrontLowerLeft");
Assert.False(k0.associateToRig);

return cfg;
}
static void SetupCubeJoint(GameObject cube, KeyPointTemplate template, string label, float x, float y, float z)
static void SetupCubeJoint(GameObject cube, KeypointTemplate template, string label, float x, float y, float z)
{
var joint = new GameObject();
joint.transform.parent = cube.transform;

jointLabel.templateInformation.Add(templateData);
}
static void SetupCubeJoints(GameObject cube, KeyPointTemplate template)
static void SetupCubeJoints(GameObject cube, KeypointTemplate template)
{
SetupCubeJoint(cube, template, "FrontLowerLeft", -0.5f, -0.5f, -0.5f);
SetupCubeJoint(cube, template, "FrontUpperLeft", -0.5f, 0.5f, -0.5f);

[UnityTest]
public IEnumerator Keypoint_TestStaticLabeledCube()
{
var incoming = new List<List<KeyPointLabeler.KeyPointEntry>>();
var incoming = new List<List<KeypointLabeler.KeypointEntry>>();
var template = CreateTestTemplate(Guid.NewGuid(), "TestTemplate");
var cam = SetupCamera(SetUpLabelConfig(), template, (data) =>

正在加载...
取消
保存