diff --git a/ZEDCamera/Assets/Editor/Scripts/ZEDCameraEditor.cs b/ZEDCamera/Assets/Editor/Scripts/ZEDCameraEditor.cs
index d89d7f8a..f2cb3bac 100644
--- a/ZEDCamera/Assets/Editor/Scripts/ZEDCameraEditor.cs
+++ b/ZEDCamera/Assets/Editor/Scripts/ZEDCameraEditor.cs
@@ -110,7 +110,6 @@ public class ZEDCameraEditor : Editor
private SerializedProperty meshPath;
//Object Detection Prop
- //private SerializedProperty OD_ImageSyncMode;
private SerializedProperty OD_ObjectTracking;
private SerializedProperty OD_2DMask;
private SerializedProperty OD_DetectionModel;
@@ -134,7 +133,6 @@ public class ZEDCameraEditor : Editor
private SerializedProperty OD_FruitVegetableFilter;
private SerializedProperty OD_SportFilter;
//Body Tracking
- private SerializedProperty BT_ImageSyncMode;
private SerializedProperty BT_ObjectTracking;
private SerializedProperty BT_2DMask;
private SerializedProperty BT_DetectionModel;
@@ -283,7 +281,6 @@ private void OnEnable()
meshPath = serializedObject.FindProperty("meshPath");
///Object Detection Serialized Properties
- //OD_ImageSyncMode = serializedObject.FindProperty("objectDetectionImageSyncMode");
OD_ObjectTracking = serializedObject.FindProperty("objectDetectionTracking");
OD_2DMask = serializedObject.FindProperty("objectDetection2DMask");
@@ -311,7 +308,6 @@ private void OnEnable()
// Body tracking serialied properties
- BT_ImageSyncMode = serializedObject.FindProperty("bodyTrackingImageSyncMode");
BT_ObjectTracking = serializedObject.FindProperty("bodyTrackingTracking");
BT_2DMask = serializedObject.FindProperty("bodyTracking2DMask");
BT_DetectionModel = serializedObject.FindProperty("bodyTrackingModel");
diff --git a/ZEDCamera/Assets/SDK/Helpers/Scripts/ObjectDetection/DetectedBody.cs b/ZEDCamera/Assets/SDK/Helpers/Scripts/ObjectDetection/DetectedBody.cs
index 5696671a..5e701d82 100644
--- a/ZEDCamera/Assets/SDK/Helpers/Scripts/ObjectDetection/DetectedBody.cs
+++ b/ZEDCamera/Assets/SDK/Helpers/Scripts/ObjectDetection/DetectedBody.cs
@@ -295,7 +295,8 @@ public bool GetMaskTexture(out Texture2D masktex, bool fliponYaxis)
if (maskTexture == null)
{
IntPtr maskpointer = maskMat.GetPtr(sl.ZEDMat.MEM.MEM_CPU);
- if (maskpointer != IntPtr.Zero)
+
+ if (maskpointer != IntPtr.Zero && maskMat.IsInit())
{
maskTexture = ZEDMatToTexture_CPU(maskMat, false);
}
diff --git a/ZEDCamera/Assets/SDK/Helpers/Scripts/ZEDManager.cs b/ZEDCamera/Assets/SDK/Helpers/Scripts/ZEDManager.cs
index e5be1b38..2345a28e 100644
--- a/ZEDCamera/Assets/SDK/Helpers/Scripts/ZEDManager.cs
+++ b/ZEDCamera/Assets/SDK/Helpers/Scripts/ZEDManager.cs
@@ -422,12 +422,6 @@ public enum shaderType
[HideInInspector]
public uint objectDetectionInstanceID = 0;
- ///
- /// Sync the Object on the image.
- ///
- [HideInInspector]
- public bool objectDetectionImageSyncMode = true;
-
///
/// Whether to track objects across multiple frames using the ZED's position relative to the floor.
/// Requires tracking to be on. It's also recommended to enable Estimate Initial Position to find the floor.
@@ -654,12 +648,6 @@ public enum shaderType
[HideInInspector]
public uint bodyTrackingInstanceID = 1;
- ///
- /// Sync the Object on the image.
- ///
- [HideInInspector]
- public bool bodyTrackingImageSyncMode = true;
-
///
/// Whether to track objects across multiple frames using the ZED's position relative to the floor.
/// Requires tracking to be on. It's also recommended to enable Estimate Initial Position to find the floor.
@@ -2546,8 +2534,7 @@ private void AcquireImages()
float camera_fps = zedCamera.GetCameraFPS();
cameraFPS = camera_fps.ToString() + " FPS";
#endif
- //Update object detection here if using object sync.
- if (objectDetectionRunning && objectDetectionImageSyncMode && requestobjectsframe)
+ if (objectDetectionRunning && requestobjectsframe)
{
if (objectDetectionModel == sl.OBJECT_DETECTION_MODEL.CUSTOM_BOX_OBJECTS)
{
@@ -2557,8 +2544,7 @@ private void AcquireImages()
RetrieveObjectDetectionFrame();
}
- //Update body tracking here if using object sync.
- if (bodyTrackingRunning && bodyTrackingImageSyncMode && requestBodiesframe)
+ if (bodyTrackingRunning && requestBodiesframe)
{
RetrieveBodyTrackingFrame();
}
@@ -3124,10 +3110,8 @@ private IEnumerator startObjectDetection()
odIsStarting = true;
Debug.LogWarning("Starting Object Detection. This may take a moment.");
- objectDetectionImageSyncMode = true;
sl.ObjectDetectionParameters od_param = new sl.ObjectDetectionParameters();
od_param.instanceModuleID = objectDetectionInstanceID;
- od_param.imageSync = objectDetectionImageSyncMode;
od_param.enableTracking = objectDetectionTracking;
od_param.enableSegmentation = objectDetection2DMask;
od_param.detectionModel = objectDetectionModel;
@@ -3213,10 +3197,6 @@ public void UpdateObjectDetection()
objectDetectionRuntimeParameters.objectClassFilter[(int)sl.OBJECT_CLASS.FRUIT_VEGETABLE] = Convert.ToInt32(objectClassFruitVegetableFilter);
objectDetectionRuntimeParameters.objectClassFilter[(int)sl.OBJECT_CLASS.SPORT] = Convert.ToInt32(objectClassSportFilter);
-
-
- if (objectDetectionImageSyncMode == false) RetrieveObjectDetectionFrame(); //If true, this is called in the AcquireImages function in the image acquisition thread.
-
if (newobjectsframeready)
{
lock (zedCamera.grabLock)
@@ -3368,7 +3348,6 @@ private IEnumerator startBodyTracking()
sl.BodyTrackingParameters bt_param = new sl.BodyTrackingParameters();
bt_param.instanceModuleID = bodyTrackingInstanceID;
- bt_param.imageSync = bodyTrackingImageSyncMode;
bt_param.enableTracking = bodyTrackingTracking;
bt_param.enableSegmentation = bodyTracking2DMask;
bt_param.detectionModel = bodyTrackingModel;
@@ -3426,8 +3405,6 @@ public void UpdateBodiesTracking()
bodyTrackingRuntimeParams.minimumKeypointsThreshold = bodyTrackingMinimumKPThreshold;
bodyTrackingRuntimeParams.skeletonSmoothing = bodyTrackingSkeletonSmoothing;
- if (bodyTrackingImageSyncMode == false) RetrieveBodyTrackingFrame(); //If true, this is called in the AcquireImages function in the image acquisition thread.
-
if (newbodiesframeready)
{
lock (zedCamera.grabLock)
diff --git a/ZEDCamera/Assets/SDK/NativeInterface/ZEDCommon.cs b/ZEDCamera/Assets/SDK/NativeInterface/ZEDCommon.cs
index d08a49df..b2d22b27 100644
--- a/ZEDCamera/Assets/SDK/NativeInterface/ZEDCommon.cs
+++ b/ZEDCamera/Assets/SDK/NativeInterface/ZEDCommon.cs
@@ -2165,11 +2165,6 @@ public struct ObjectDetectionParameters
///
public uint instanceModuleID;
///
- /// Defines if the object detection is synchronized to the image or runs in a separate thread.
- ///
- [MarshalAs(UnmanagedType.U1)]
- public bool imageSync;
- ///
/// Defines if the object detection will track objects across multiple images, instead of an image-by-image basis.
///
[MarshalAs(UnmanagedType.U1)]
@@ -2461,11 +2456,6 @@ public struct BodyTrackingParameters
///
public uint instanceModuleID;
///
- /// Defines if the object detection is synchronized to the image or runs in a separate thread.
- ///
- [MarshalAs(UnmanagedType.U1)]
- public bool imageSync;
- ///
/// Defines if the object detection will track objects across multiple images, instead of an image-by-image basis.
///
[MarshalAs(UnmanagedType.U1)]
diff --git a/ZEDCamera/Assets/SDK/Plugins/win64/sl_unitywrapper.dll b/ZEDCamera/Assets/SDK/Plugins/win64/sl_unitywrapper.dll
index 373bbb35..336994fe 100644
Binary files a/ZEDCamera/Assets/SDK/Plugins/win64/sl_unitywrapper.dll and b/ZEDCamera/Assets/SDK/Plugins/win64/sl_unitywrapper.dll differ
diff --git a/ZEDCamera/Assets/Samples~/Object Detection/Scripts/ZED2DObjectVisualizer.cs b/ZEDCamera/Assets/Samples~/Object Detection/Scripts/ZED2DObjectVisualizer.cs
index 80259143..1bfdb73b 100644
--- a/ZEDCamera/Assets/Samples~/Object Detection/Scripts/ZED2DObjectVisualizer.cs
+++ b/ZEDCamera/Assets/Samples~/Object Detection/Scripts/ZED2DObjectVisualizer.cs
@@ -248,9 +248,9 @@ public void Visualize2DBoundingBoxes(ObjectDetectionFrame dframe)
bbox.sizeDelta = new Vector2(objrect.width, objrect.height);
bbox.anchoredPosition = new Vector2(objrect.x, objrect.y);
-
+ bool ShowMaskIsEnabled = detectionMode == DetectionMode.BodyTracking ? zedManager.bodyTracking2DMask : zedManager.objectDetection2DMask;
//Apply the mask.
- if (showObjectMask)
+ if (showObjectMask && ShowMaskIsEnabled)
{
//Make a new image for this new mask.
Texture2D maskimage;
@@ -310,9 +310,11 @@ public void Visualize2DBoundingBoxes(BodyTrackingFrame dframe)
//Adjust the size of the RectTransform to encompass the object.
bbox.sizeDelta = new Vector2(objrect.width, objrect.height);
bbox.anchoredPosition = new Vector2(objrect.x, objrect.y);
-
+
+ bool ShowMaskIsEnabled = detectionMode == DetectionMode.BodyTracking ? zedManager.bodyTracking2DMask : zedManager.objectDetection2DMask;
+
//Apply the mask.
- if (showObjectMask)
+ if (showObjectMask && ShowMaskIsEnabled)
{
//Make a new image for this new mask.
Texture2D maskimage;