Skip to content

Commit 3c3d4a7

Browse files
push to 4.0.4 (#259)
* ignore wrapper if in folder * remove body 70 & add skeleton smoothing & add warning when no animator * change plugin version to 4.0.4 * add positional tracking mode parameter * add positional tracking mode in zedmanager inspector * fix opencv sample * change default aruco in opencv scene * readd body 70 * update linux lib * add default constructor to Rect struct --------- Co-authored-by: Jean-Loup Macarit <jeanloup.macarit@stereolabs.com>
1 parent b25cf15 commit 3c3d4a7

File tree

13 files changed

+284
-345
lines changed

13 files changed

+284
-345
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[Bb]uild/
55
[Bb]uilds/
66
Assets/AssetStoreTools*
7+
unity-wrapper/
78

89
# Visual Studio cache directory
910
.vs/

ZEDCamera/Assets/ZED/Editor/Scripts/ZEDCameraEditor.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class ZEDCameraEditor : Editor
5151
private SerializedProperty pathSMProperty;
5252
private SerializedProperty floorAsOriginProperty;
5353
private SerializedProperty trackingIsStaticProperty;
54+
private SerializedProperty positionalTrackingModeProperty;
5455

5556
//Rendering Prop
5657
private SerializedProperty depthOcclusionProperty;
@@ -147,6 +148,7 @@ public class ZEDCameraEditor : Editor
147148
// runtime params
148149
private SerializedProperty BT_Confidence;
149150
private SerializedProperty BT_MinimumKPThresh;
151+
private SerializedProperty BT_SkSmoothing;
150152

151153
/// <summary>
152154
/// Layout option used to draw the '...' button for opening a File Explorer window to find a mesh file.
@@ -259,6 +261,7 @@ private void OnEnable()
259261
pathSMProperty = serializedObject.FindProperty("pathSpatialMemory");
260262
floorAsOriginProperty = serializedObject.FindProperty("setFloorAsOrigin");
261263
trackingIsStaticProperty = serializedObject.FindProperty("trackingIsStatic");
264+
positionalTrackingModeProperty = serializedObject.FindProperty("positionalTrackingMode");
262265

263266

264267
///Rendering Serialized Properties
@@ -317,6 +320,7 @@ private void OnEnable()
317320
BT_BodySelection = serializedObject.FindProperty("bodySelection");
318321

319322
BT_Confidence = serializedObject.FindProperty("bodyTrackingConfidenceThreshold");
323+
BT_SkSmoothing = serializedObject.FindProperty("bodyTrackingSkeletonSmoothing");
320324
//Recording Serialized Properties
321325
svoOutputFileNameProperty = serializedObject.FindProperty("svoOutputFileName");
322326
svoOutputCompressionModeProperty = serializedObject.FindProperty("svoOutputCompressionMode");
@@ -593,6 +597,8 @@ public override void OnInspectorGUI()
593597
"Can be useful for stationary cameras where you still need tracking enabled, such as in Object Detection.");
594598
trackingIsStaticProperty.boolValue = EditorGUILayout.Toggle(trackingIsStaticPropertyLabel, trackingIsStaticProperty.boolValue);
595599

600+
GUIContent positionalTrackingModePropertyLabel = new GUIContent("Positional Tracking Mode", "Lists the mode of positional tracking that can be used.");
601+
positionalTrackingModeProperty.enumValueIndex = (int)(sl.POSTIONAL_TRACKING_MODE)EditorGUILayout.EnumPopup(positionalTrackingModePropertyLabel, (sl.POSTIONAL_TRACKING_MODE)positionalTrackingModeProperty.enumValueIndex);
596602

597603
EditorGUI.indentLevel--;
598604

@@ -1016,6 +1022,9 @@ public override void OnInspectorGUI()
10161022
"an object exists to report it.\r\n\nEx: If the threshold is 80, then only objects where the SDK is 80% sure or greater will appear in the list of detected objects.");
10171023
BT_Confidence.intValue = EditorGUILayout.IntSlider(BodyTrackingConfidenceLabel, BT_Confidence.intValue, 1, 99);
10181024

1025+
GUIContent BT_SkSmoothingLabel = new GUIContent("Skeleton Smoothing", "From 0 (no smoothing) to 1 (max smoothing), amount of smoothing applied to the skeleton data during the fitting. Higher values will have more latency, but less jitter.");
1026+
BT_SkSmoothing.floatValue = EditorGUILayout.Slider(BT_SkSmoothingLabel, BT_SkSmoothing.floatValue, 0, 1.0f);
1027+
10191028
GUI.enabled = cameraIsReady;
10201029

10211030
GUILayout.Space(10);

ZEDCamera/Assets/ZED/Examples/Body Tracking/Scene/BodyTrackingMulti.unity

Lines changed: 180 additions & 320 deletions
Large diffs are not rendered by default.

ZEDCamera/Assets/ZED/Examples/OpenCV ArUco Detection/Scenes/Simple Marker Placement.unity

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ MeshRenderer:
161161
m_CastShadows: 1
162162
m_ReceiveShadows: 1
163163
m_DynamicOccludee: 1
164+
m_StaticShadowCaster: 0
164165
m_MotionVectors: 1
165166
m_LightProbeUsage: 1
166167
m_ReflectionProbeUsage: 1
@@ -214,6 +215,7 @@ Transform:
214215
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
215216
m_LocalPosition: {x: 0, y: 0, z: 0}
216217
m_LocalScale: {x: 1, y: 1, z: 0.1}
218+
m_ConstrainProportionsScale: 0
217219
m_Children: []
218220
m_Father: {fileID: 1380222653}
219221
m_RootOrder: 0
@@ -273,6 +275,7 @@ Transform:
273275
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
274276
m_LocalPosition: {x: -4.2, y: 0, z: 0}
275277
m_LocalScale: {x: 1, y: 1, z: 1}
278+
m_ConstrainProportionsScale: 0
276279
m_Children:
277280
- {fileID: 2010391085}
278281
m_Father: {fileID: 0}
@@ -316,6 +319,7 @@ MeshRenderer:
316319
m_CastShadows: 1
317320
m_ReceiveShadows: 1
318321
m_DynamicOccludee: 1
322+
m_StaticShadowCaster: 0
319323
m_MotionVectors: 1
320324
m_LightProbeUsage: 1
321325
m_ReflectionProbeUsage: 1
@@ -369,6 +373,7 @@ Transform:
369373
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
370374
m_LocalPosition: {x: 0, y: 0, z: 0}
371375
m_LocalScale: {x: 1, y: 1, z: 0.1}
376+
m_ConstrainProportionsScale: 0
372377
m_Children: []
373378
m_Father: {fileID: 599479602}
374379
m_RootOrder: 0
@@ -380,7 +385,7 @@ LightingSettings:
380385
m_PrefabInstance: {fileID: 0}
381386
m_PrefabAsset: {fileID: 0}
382387
m_Name: Settings.lighting
383-
serializedVersion: 3
388+
serializedVersion: 4
384389
m_GIWorkflowMode: 0
385390
m_EnableBakedLightmaps: 1
386391
m_EnableRealtimeLightmaps: 1
@@ -393,7 +398,7 @@ LightingSettings:
393398
m_LightmapMaxSize: 1024
394399
m_BakeResolution: 40
395400
m_Padding: 2
396-
m_TextureCompression: 1
401+
m_LightmapCompression: 3
397402
m_AO: 0
398403
m_AOMaxDistance: 1
399404
m_CompAOExponent: 1
@@ -434,10 +439,10 @@ LightingSettings:
434439
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
435440
m_PVRFilteringAtrousPositionSigmaIndirect: 2
436441
m_PVRFilteringAtrousPositionSigmaAO: 1
442+
m_PVRTiledBaking: 0
437443
--- !u!114 &407337776 stripped
438444
MonoBehaviour:
439-
m_CorrespondingSourceObject: {fileID: 114711245158774928, guid: e13ee7e0790c7d243b7aa67fe604acac,
440-
type: 3}
445+
m_CorrespondingSourceObject: {fileID: 114711245158774928, guid: e13ee7e0790c7d243b7aa67fe604acac, type: 3}
441446
m_PrefabInstance: {fileID: 883453435}
442447
m_PrefabAsset: {fileID: 0}
443448
m_GameObject: {fileID: 0}
@@ -501,6 +506,7 @@ Transform:
501506
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
502507
m_LocalPosition: {x: -3.15, y: 0, z: 0}
503508
m_LocalScale: {x: 1, y: 1, z: 1}
509+
m_ConstrainProportionsScale: 0
504510
m_Children:
505511
- {fileID: 126909665}
506512
m_Father: {fileID: 0}
@@ -534,6 +540,7 @@ Transform:
534540
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
535541
m_LocalPosition: {x: -0.0008588135, y: 0, z: 0}
536542
m_LocalScale: {x: 1, y: 1, z: 1}
543+
m_ConstrainProportionsScale: 0
537544
m_Children:
538545
- {fileID: 1094516502}
539546
m_Father: {fileID: 0}
@@ -657,6 +664,7 @@ RectTransform:
657664
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
658665
m_LocalPosition: {x: 0, y: 0, z: 0}
659666
m_LocalScale: {x: 0, y: 0, z: 0}
667+
m_ConstrainProportionsScale: 0
660668
m_Children:
661669
- {fileID: 1436819744}
662670
m_Father: {fileID: 0}
@@ -711,7 +719,7 @@ MonoBehaviour:
711719
m_EditorClassIdentifier:
712720
imageRetriever: {fileID: 859701131}
713721
markerWidthMeters: 0.175
714-
markerDictionary: 9
722+
markerDictionary: 0
715723
--- !u!4 &857114140
716724
Transform:
717725
m_ObjectHideFlags: 0
@@ -722,6 +730,7 @@ Transform:
722730
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
723731
m_LocalPosition: {x: 0, y: 0, z: 0}
724732
m_LocalScale: {x: 1, y: 1, z: 1}
733+
m_ConstrainProportionsScale: 0
725734
m_Children: []
726735
m_Father: {fileID: 0}
727736
m_RootOrder: 3
@@ -766,6 +775,7 @@ Transform:
766775
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
767776
m_LocalPosition: {x: -0.46380258, y: 0.45984256, z: 3.7793646}
768777
m_LocalScale: {x: 1, y: 1, z: 1}
778+
m_ConstrainProportionsScale: 0
769779
m_Children: []
770780
m_Father: {fileID: 0}
771781
m_RootOrder: 2
@@ -809,13 +819,11 @@ PrefabInstance:
809819
propertyPath: m_LocalRotation.z
810820
value: 0
811821
objectReference: {fileID: 0}
812-
- target: {fileID: 114711245158774928, guid: e13ee7e0790c7d243b7aa67fe604acac,
813-
type: 3}
822+
- target: {fileID: 114711245158774928, guid: e13ee7e0790c7d243b7aa67fe604acac, type: 3}
814823
propertyPath: showarrig
815824
value: 1
816825
objectReference: {fileID: 0}
817-
- target: {fileID: 114711245158774928, guid: e13ee7e0790c7d243b7aa67fe604acac,
818-
type: 3}
826+
- target: {fileID: 114711245158774928, guid: e13ee7e0790c7d243b7aa67fe604acac, type: 3}
819827
propertyPath: advancedPanelOpen
820828
value: 1
821829
objectReference: {fileID: 0}
@@ -850,6 +858,7 @@ Transform:
850858
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
851859
m_LocalPosition: {x: 0, y: 0, z: 0}
852860
m_LocalScale: {x: 1, y: 1, z: 0.1}
861+
m_ConstrainProportionsScale: 0
853862
m_Children: []
854863
m_Father: {fileID: 757982340}
855864
m_RootOrder: 0
@@ -865,6 +874,7 @@ MeshRenderer:
865874
m_CastShadows: 1
866875
m_ReceiveShadows: 1
867876
m_DynamicOccludee: 1
877+
m_StaticShadowCaster: 0
868878
m_MotionVectors: 1
869879
m_LightProbeUsage: 1
870880
m_ReflectionProbeUsage: 1
@@ -971,6 +981,7 @@ Transform:
971981
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
972982
m_LocalPosition: {x: -2.1, y: 0, z: 0}
973983
m_LocalScale: {x: 1, y: 1, z: 1}
984+
m_ConstrainProportionsScale: 0
974985
m_Children:
975986
- {fileID: 81208245}
976987
m_Father: {fileID: 0}
@@ -1004,6 +1015,7 @@ RectTransform:
10041015
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
10051016
m_LocalPosition: {x: 0, y: 0, z: 0}
10061017
m_LocalScale: {x: 1, y: 1, z: 1}
1018+
m_ConstrainProportionsScale: 0
10071019
m_Children: []
10081020
m_Father: {fileID: 771887902}
10091021
m_RootOrder: 0
@@ -1145,6 +1157,7 @@ Transform:
11451157
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
11461158
m_LocalPosition: {x: 0, y: 3, z: 0}
11471159
m_LocalScale: {x: 1, y: 1, z: 1}
1160+
m_ConstrainProportionsScale: 0
11481161
m_Children: []
11491162
m_Father: {fileID: 0}
11501163
m_RootOrder: 0
@@ -1187,6 +1200,7 @@ MeshRenderer:
11871200
m_CastShadows: 1
11881201
m_ReceiveShadows: 1
11891202
m_DynamicOccludee: 1
1203+
m_StaticShadowCaster: 0
11901204
m_MotionVectors: 1
11911205
m_LightProbeUsage: 1
11921206
m_ReflectionProbeUsage: 1
@@ -1240,6 +1254,7 @@ Transform:
12401254
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
12411255
m_LocalPosition: {x: 0, y: 0, z: 0}
12421256
m_LocalScale: {x: 1, y: 1, z: 0.1}
1257+
m_ConstrainProportionsScale: 0
12431258
m_Children: []
12441259
m_Father: {fileID: 98179969}
12451260
m_RootOrder: 0
@@ -1282,6 +1297,7 @@ MeshRenderer:
12821297
m_CastShadows: 1
12831298
m_ReceiveShadows: 1
12841299
m_DynamicOccludee: 1
1300+
m_StaticShadowCaster: 0
12851301
m_MotionVectors: 1
12861302
m_LightProbeUsage: 1
12871303
m_ReflectionProbeUsage: 1
@@ -1335,6 +1351,7 @@ Transform:
13351351
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
13361352
m_LocalPosition: {x: 0, y: 0, z: 0}
13371353
m_LocalScale: {x: 1, y: 1, z: 0.1}
1354+
m_ConstrainProportionsScale: 0
13381355
m_Children: []
13391356
m_Father: {fileID: 2101091372}
13401357
m_RootOrder: 0
@@ -1369,6 +1386,7 @@ MonoBehaviour:
13691386
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
13701387
m_Name:
13711388
m_EditorClassIdentifier:
1389+
m_SendPointerHoverToParent: 1
13721390
m_HorizontalAxis: Horizontal
13731391
m_VerticalAxis: Vertical
13741392
m_SubmitButton: Submit
@@ -1401,6 +1419,7 @@ Transform:
14011419
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
14021420
m_LocalPosition: {x: 0, y: 0, z: 0}
14031421
m_LocalScale: {x: 1, y: 1, z: 1}
1422+
m_ConstrainProportionsScale: 0
14041423
m_Children: []
14051424
m_Father: {fileID: 0}
14061425
m_RootOrder: 10
@@ -1460,6 +1479,7 @@ Transform:
14601479
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
14611480
m_LocalPosition: {x: -1.05, y: 0, z: 0}
14621481
m_LocalScale: {x: 1, y: 1, z: 1}
1482+
m_ConstrainProportionsScale: 0
14631483
m_Children:
14641484
- {fileID: 2035212747}
14651485
m_Father: {fileID: 0}

ZEDCamera/Assets/ZED/Examples/OpenCV ArUco Detection/Scripts/Core/ZEDToOpenCVRetriever.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ private void DeployGrabbedEvent(Camera cam, ref ZEDMat zedmat, VIEW view, ZEDMat
214214
Mat buffermat = GetOpenCVBufferMat(zedCam.ImageHeight, zedCam.ImageWidth, SLMatType2CVMatType(mattype));
215215

216216
//copyToMat(zedmat.GetPtr(), cvMat);
217-
MatUtils.copyFromMat(buffermat, zedmat.GetPtr());
217+
//MatUtils.copyFromMat(buffermat, zedmat.GetPtr());
218+
MatUtils.copyToMat(zedmat.GetPtr(), buffermat);
218219

219220
ConvertColorSpace(buffermat, ref cvMat, conversionatend);
220221
//Mat convertedmat = ConvertColorSpace(buffermat, conversionatend);

ZEDCamera/Assets/ZED/SDK/Helpers/Scripts/BodyTracking/SkeletonHandler.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ private void UpdateCurrentValues(sl.BODY_FORMAT pBodyFormat)
871871
currentKeypointsCount = JointType_70_COUNT;
872872
break;
873873
default:
874-
Debug.LogError("Error: Invalid BODY_MODEL! Please use either BODY_34, BODY_38 or BODY_70.");
874+
Debug.LogError("Error: Invalid BODY_MODEL! Please use either BODY_34 or BODY_38.");
875875
#if UNITY_EDITOR
876876
EditorApplication.ExitPlaymode();
877877
#else
@@ -1074,9 +1074,10 @@ public void InitSkeleton(int person_id, Material skBaseMat)
10741074
//sphere.layer = LayerMask.NameToLayer("tagInvisibleToZED");
10751075
sphere.GetComponent<Renderer>().material = skBaseMat;
10761076
skBaseMat.color = color;
1077-
sphere.transform.localScale = (BodyFormat == sl.BODY_FORMAT.BODY_70 && j >= JointType_70_LEFT_HAND_THUMB_1)
1077+
sphere.transform.localScale = (BodyFormat == sl.BODY_FORMAT.BODY_70 && j >= JointType_70_LEFT_HAND_THUMB_1)
10781078
? new Vector3(width, width, width)
10791079
: new Vector3(width * 2, width * 2, width * 2);
1080+
//sphere.transform.localScale = new Vector3(width * 2, width * 2, width * 2);
10801081
sphere.transform.parent = skeleton.transform;
10811082
sphere.name = currentSpheresList[j].ToString();
10821083
spheres[j] = sphere;
@@ -1119,10 +1120,11 @@ void UpdateSkeleton(Vector3 offsetSDK, bool mirrorMode = false)
11191120

11201121
bones[i].SetActive(true);
11211122
Vector3 offset = end - start;
1122-
// if hands, thinner cylinders
1123-
Vector3 scale = (BodyFormat == sl.BODY_FORMAT.BODY_70 && i >= 29 )
1124-
? new Vector3(width/2f, offset.magnitude / 2.0f, width/2f)
1123+
// if hands Body70, thinner cylinders
1124+
Vector3 scale = (BodyFormat == sl.BODY_FORMAT.BODY_70 && i >= 29)
1125+
? new Vector3(width / 2f, offset.magnitude / 2.0f, width / 2f)
11251126
: new Vector3(width, offset.magnitude / 2.0f, width);
1127+
//Vector3 scale = new Vector3(width, offset.magnitude / 2.0f, width);
11261128
Vector3 position = start + (offset / 2.0f);
11271129

11281130
bones[i].transform.position = position;

ZEDCamera/Assets/ZED/SDK/Helpers/Scripts/BodyTracking/ZEDBodyTrackingManager.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ void Start()
155155
zedManager = FindObjectOfType<ZEDManager>();
156156
}
157157

158+
if(avatar.GetComponent<Animator>().runtimeAnimatorController == null)
159+
{
160+
Debug.LogWarning("Animator has no animator controller. Animation from ZED plugin will not work.");
161+
}
162+
158163
if (zedManager)
159164
{
160165

ZEDCamera/Assets/ZED/SDK/Helpers/Scripts/SpatialMapping/ZEDSpatialMapping.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ public bool LoadMesh(string meshFilePath = "ZEDMesh.obj")
847847
zedCamera.DisableTracking();
848848
Quaternion quat = Quaternion.identity; Vector3 tr = Vector3.zero;
849849

850-
if (zedCamera.EnableTracking(ref quat, ref tr, true, false, false, false, true, -1.0f, true, System.IO.File.Exists(basePath + ".area") ? basePath + ".area" : "") != sl.ERROR_CODE.SUCCESS)
850+
if (zedCamera.EnableTracking(ref quat, ref tr, true, false, false, false, true, -1.0f, true, sl.POSTIONAL_TRACKING_MODE.STANDARD, System.IO.File.Exists(basePath + ".area") ? basePath + ".area" : "") != sl.ERROR_CODE.SUCCESS)
851851
{
852852
Debug.LogWarning(ZEDLogMessage.Error2Str(ZEDLogMessage.ERROR.TRACKING_NOT_INITIALIZED));
853853
}

0 commit comments

Comments
 (0)