|
|
|
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
static GameObject SetupCamera(IdLabelConfig config, KeypointTemplate template, Action<int, List<KeypointLabeler.KeypointEntry>> computeListener, RenderTexture renderTexture = null, KeypointObjectFilter keypointObjectFilter = KeypointObjectFilter.Visible, float defaultSelfOcclusionDistance = 0.15f) |
|
|
|
static GameObject SetupCamera(IdLabelConfig config, KeypointTemplate template, Action<int, List<KeypointLabeler.KeypointEntry>> computeListener, RenderTexture renderTexture = null, KeypointObjectFilter keypointObjectFilter = KeypointObjectFilter.Visible) |
|
|
|
{ |
|
|
|
var cameraObject = new GameObject(); |
|
|
|
cameraObject.SetActive(false); |
|
|
|
|
|
|
perceptionCamera.captureRgbImages = false; |
|
|
|
var keyPointLabeler = new KeypointLabeler(config, template); |
|
|
|
keyPointLabeler.objectFilter = keypointObjectFilter; |
|
|
|
keyPointLabeler.selfOcclusionDistance = defaultSelfOcclusionDistance; |
|
|
|
if (computeListener != null) |
|
|
|
keyPointLabeler.KeypointsComputed += computeListener; |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
static KeypointTemplate CreateTestTemplate(Guid guid, string label) |
|
|
|
static KeypointTemplate CreateTestTemplate(Guid guid, string label, float selfOcclusionDistance = 0.15f) |
|
|
|
{ |
|
|
|
var keypoints = new[] |
|
|
|
{ |
|
|
|
|
|
|
associateToRig = false, |
|
|
|
color = Color.black |
|
|
|
color = Color.black, |
|
|
|
selfOcclusionDistance = selfOcclusionDistance |
|
|
|
color = Color.black |
|
|
|
color = Color.black, |
|
|
|
selfOcclusionDistance = selfOcclusionDistance |
|
|
|
color = Color.black |
|
|
|
color = Color.black, |
|
|
|
selfOcclusionDistance = selfOcclusionDistance |
|
|
|
color = Color.black |
|
|
|
color = Color.black, |
|
|
|
selfOcclusionDistance = selfOcclusionDistance |
|
|
|
color = Color.black |
|
|
|
color = Color.black, |
|
|
|
selfOcclusionDistance = selfOcclusionDistance |
|
|
|
color = Color.black |
|
|
|
color = Color.black, |
|
|
|
selfOcclusionDistance = selfOcclusionDistance |
|
|
|
color = Color.black |
|
|
|
color = Color.black, |
|
|
|
selfOcclusionDistance = selfOcclusionDistance |
|
|
|
color = Color.black |
|
|
|
color = Color.black, |
|
|
|
selfOcclusionDistance = selfOcclusionDistance |
|
|
|
color = Color.black |
|
|
|
color = Color.black, |
|
|
|
selfOcclusionDistance = selfOcclusionDistance |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
jointLabel.labels.Add(label); |
|
|
|
if (selfOcclusionDistance.HasValue) |
|
|
|
{ |
|
|
|
jointLabel.selfOcclusionDistanceSource = SelfOcclusionDistanceSource.JointLabel; |
|
|
|
jointLabel.overrideSelfOcclusionDistance = true; |
|
|
|
jointLabel.selfOcclusionDistanceSource = SelfOcclusionDistanceSource.KeypointLabeler; |
|
|
|
jointLabel.overrideSelfOcclusionDistance = false; |
|
|
|
} |
|
|
|
|
|
|
|
static void SetupCubeJoints(GameObject cube, KeypointTemplate template, float? selfOcclusionDistance = null) |
|
|
|
|
|
|
[Values(ProjectionKind.Orthographic, ProjectionKind.Projection)] ProjectionKind projectionKind) |
|
|
|
{ |
|
|
|
var incoming = new List<List<KeypointLabeler.KeypointEntry>>(); |
|
|
|
var template = CreateTestTemplate(Guid.NewGuid(), "TestTemplate"); |
|
|
|
var frameSize = 1024; |
|
|
|
var texture = new RenderTexture(frameSize, frameSize, 16); |
|
|
|
var template = CreateTestTemplate(Guid.NewGuid(), "TestTemplate", selfOcclusionDistance: labelerSelfOcclusionDistance); |
|
|
|
var frameSize = 1024; |
|
|
|
var texture = new RenderTexture(frameSize, frameSize, 16); |
|
|
|
}, texture, defaultSelfOcclusionDistance: labelerSelfOcclusionDistance); |
|
|
|
}, texture); |
|
|
|
var camComponent = cam.GetComponent<Camera>(); |
|
|
|
camComponent.fieldOfView = args.cameraFieldOfView; |
|
|
|
camComponent.farClipPlane = 100f; |
|
|
|
|
|
|
(Vector3 objectScale, Quaternion rotation, float checkDistance, Vector3 pointLocalPosition, bool expectOccluded) args) |
|
|
|
{ |
|
|
|
var incoming = new List<List<KeypointLabeler.KeypointEntry>>(); |
|
|
|
var template = CreateTestTemplate(Guid.NewGuid(), "TestTemplate"); |
|
|
|
var labelerSelfOcclusionDistance = 0.5f; |
|
|
|
var template = CreateTestTemplate(Guid.NewGuid(), "TestTemplate", labelerSelfOcclusionDistance); |
|
|
|
var labelerSelfOcclusionDistance = 0.5f; |
|
|
|
}, texture, defaultSelfOcclusionDistance: labelerSelfOcclusionDistance); |
|
|
|
}, texture); |
|
|
|
var camComponent = cam.GetComponent<Camera>(); |
|
|
|
camComponent.orthographic = true; |
|
|
|
camComponent.orthographicSize = 100f; |
|
|
|
|
|
|
public IEnumerator ManyObjects_LabelsCorrectly() |
|
|
|
{ |
|
|
|
var incoming = new List<List<KeypointLabeler.KeypointEntry>>(); |
|
|
|
var template = CreateTestTemplate(Guid.NewGuid(), "TestTemplate"); |
|
|
|
var labelerSelfOcclusionDistance = 0.5f; |
|
|
|
var template = CreateTestTemplate(Guid.NewGuid(), "TestTemplate", selfOcclusionDistance: labelerSelfOcclusionDistance); |
|
|
|
var labelerSelfOcclusionDistance = 0.5f; |
|
|
|
}, texture, defaultSelfOcclusionDistance: labelerSelfOcclusionDistance); |
|
|
|
}, texture); |
|
|
|
|
|
|
|
void PlaceObjects(Rect rect, float z, Vector2Int count) |
|
|
|
{ |
|
|
|