浏览代码

Adding gizmos for keypoints

/keypoint_self_occlusion
Jon Hogins 3 年前
当前提交
039274cd
共有 5 个文件被更改,包括 194 次插入26 次删除
  1. 66
      TestProjects/PerceptionURP/Assets/Prefabs/KeypointCube.prefab
  2. 41
      com.unity.perception/Runtime/GroundTruth/Labelers/JointLabel.cs
  3. 4
      com.unity.perception/Runtime/GroundTruth/Labelers/KeypointLabeler.cs
  4. 17
      com.unity.perception/Editor/Icons/Keypoint.png
  5. 92
      com.unity.perception/Editor/Icons/Keypoint.png.meta

66
TestProjects/PerceptionURP/Assets/Prefabs/KeypointCube.prefab


m_Script: {fileID: 11500000, guid: 8cf4fa374b134b1680755f8280ae8e7d, type: 3}
m_Name:
m_EditorClassIdentifier:
templateInformation:
- template: {fileID: 11400000, guid: 90217544e06a7b1408543cd72382ccbb, type: 2}
label: FrontBottomRight
templateInformation: []
labels:
- FrontBottomRight
selfOcclusionDistanceSource: 0
selfOcclusionDistance: 0.15
--- !u!1 &3710685714022253438
GameObject:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: 8cf4fa374b134b1680755f8280ae8e7d, type: 3}
m_Name:
m_EditorClassIdentifier:
templateInformation:
- template: {fileID: 11400000, guid: 90217544e06a7b1408543cd72382ccbb, type: 2}
label: BackBottomRight
templateInformation: []
labels:
- BackBottomRight
selfOcclusionDistanceSource: 0
selfOcclusionDistance: 0.15
--- !u!1 &3710685714250655251
GameObject:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: 8cf4fa374b134b1680755f8280ae8e7d, type: 3}
m_Name:
m_EditorClassIdentifier:
templateInformation:
- template: {fileID: 11400000, guid: 90217544e06a7b1408543cd72382ccbb, type: 2}
label: BackTopRight
templateInformation: []
labels:
- BackTopRight
selfOcclusionDistanceSource: 0
selfOcclusionDistance: 0.08
--- !u!1 &3710685714462346527
GameObject:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: 8cf4fa374b134b1680755f8280ae8e7d, type: 3}
m_Name:
m_EditorClassIdentifier:
templateInformation:
- template: {fileID: 11400000, guid: 90217544e06a7b1408543cd72382ccbb, type: 2}
label: FrontTopLeft
templateInformation: []
labels:
- FrontTopLeft
selfOcclusionDistanceSource: 0
selfOcclusionDistance: 0.15
--- !u!1 &3710685714481788901
GameObject:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: 8cf4fa374b134b1680755f8280ae8e7d, type: 3}
m_Name:
m_EditorClassIdentifier:
templateInformation:
- template: {fileID: 11400000, guid: 90217544e06a7b1408543cd72382ccbb, type: 2}
label: BackBottomLeft
templateInformation: []
labels:
- BackBottomLeft
selfOcclusionDistanceSource: 0
selfOcclusionDistance: 0.15
--- !u!1 &3710685714524957768
GameObject:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: 8cf4fa374b134b1680755f8280ae8e7d, type: 3}
m_Name:
m_EditorClassIdentifier:
templateInformation:
- template: {fileID: 11400000, guid: 90217544e06a7b1408543cd72382ccbb, type: 2}
label: FrontTopRight
templateInformation: []
labels:
- FrontTopRight
selfOcclusionDistanceSource: 0
selfOcclusionDistance: 0.09
--- !u!1 &3710685714572991348
GameObject:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: 8cf4fa374b134b1680755f8280ae8e7d, type: 3}
m_Name:
m_EditorClassIdentifier:
templateInformation:
- template: {fileID: 11400000, guid: 90217544e06a7b1408543cd72382ccbb, type: 2}
label: BackTopLeft
templateInformation: []
labels:
- BackTopLeft
selfOcclusionDistanceSource: 0
selfOcclusionDistance: 0.15
--- !u!1 &3710685714995308732
GameObject:
m_ObjectHideFlags: 0

- component: {fileID: 3710685714995308733}
- component: {fileID: 3710685714995308721}
m_Layer: 0
m_Name: Cube
m_Name: KeypointCube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

m_Script: {fileID: 11500000, guid: 8cf4fa374b134b1680755f8280ae8e7d, type: 3}
m_Name:
m_EditorClassIdentifier:
templateInformation:
- template: {fileID: 11400000, guid: 90217544e06a7b1408543cd72382ccbb, type: 2}
label: FrontBottomLeft
templateInformation: []
labels:
- FrontBottomLeft
selfOcclusionDistanceSource: 0
selfOcclusionDistance: 0.15

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


using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Serialization;

[Serializable]
public class JointLabel : MonoBehaviour, ISerializationCallbackReceiver
{
private static PerceptionCamera singlePerceptionCamera = null;
/// <summary>
/// Maps this joint to a joint in a <see cref="KeypointTemplate"/>
/// </summary>

templateInformation = null;
}
}
private void OnDrawGizmos()
{
Gizmos.DrawIcon(transform.position, "Packages/com.unity.perception/Editor/Icons/Keypoint.png", false);
}
private void OnDrawGizmosSelected()
{
if (singlePerceptionCamera == null)
{
singlePerceptionCamera = FindObjectOfType<PerceptionCamera>();
}
float occlusionDistance;
switch (selfOcclusionDistanceSource)
{
case SelfOcclusionDistanceSource.JointLabel:
occlusionDistance = selfOcclusionDistance;
break;
case SelfOcclusionDistanceSource.KeypointLabeler:
if (singlePerceptionCamera == null)
{
occlusionDistance = KeypointLabeler.defaultSelfOcclusionDistance;
}
else
{
var keypointLabeler = (KeypointLabeler) singlePerceptionCamera.labelers.FirstOrDefault(l => l is KeypointLabeler);
if (keypointLabeler == null)
occlusionDistance = KeypointLabeler.defaultSelfOcclusionDistance;
else
occlusionDistance = keypointLabeler.selfOcclusionDistance;
}
break;
default:
throw new InvalidOperationException("Invalid SelfOcclusionDistanceSource");
}
Gizmos.color = /*Color.green;*/new Color(1, 1, 1, .5f);
Gizmos.DrawWireSphere(transform.position, occlusionDistance);
}
}
}

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


[Serializable]
public sealed class KeypointLabeler : CameraLabeler
{
internal const float defaultSelfOcclusionDistance = 0.15f;
/// <summary>
/// The active keypoint template. Required to annotate keypoint data.
/// </summary>

/// <summary>
/// The max distance a keypoint can be from the front of an object before it is considered occluded
/// </summary>
public float selfOcclusionDistance = 0.15f;
public float selfOcclusionDistance = defaultSelfOcclusionDistance;
// ReSharper restore MemberCanBePrivate.Global
AnnotationDefinition m_AnnotationDefinition;

17
com.unity.perception/Editor/Icons/Keypoint.png

之前 之后
宽度: 12  |  高度: 12  |  大小: 1.8 KiB

92
com.unity.perception/Editor/Icons/Keypoint.png.meta


fileFormatVersion: 2
guid: bf6fd6a0ba66efb49bfa853c76e36dcb
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存