@@ -285,7 +285,7 @@ public int TagInvisibleToZED
285285 /// <summary>
286286 /// Current Plugin Version.
287287 /// </summary>
288- public static readonly System . Version PluginVersion = new System . Version ( 4 , 1 , 0 ) ;
288+ public static readonly System . Version PluginVersion = new System . Version ( 4 , 2 , 0 ) ;
289289
290290 /******** DLL members ***********/
291291 [ DllImport ( nameDll , EntryPoint = "GetRenderEventFunc" ) ]
@@ -735,6 +735,9 @@ private static extern int dllz_enable_tracking(int cameraID, ref Quaternion quat
735735 [ DllImport ( nameDll , EntryPoint = "sl_retrieve_objects" ) ]
736736 private static extern int dllz_retrieve_objects_data ( int cameraID , ref ObjectDetectionRuntimeParameters od_params , ref Objects objs , uint instanceID ) ;
737737
738+ [ DllImport ( nameDll , EntryPoint = "sl_retrieve_custom_objects" ) ]
739+ private static extern int dllz_retrieve_custom_objects ( int cameraID , ref dll_customObjectDetectionRuntimeParameters od_params , ref Objects objs , uint instanceID ) ;
740+
738741 [ DllImport ( nameDll , EntryPoint = "sl_enable_body_tracking" ) ]
739742 private static extern int dllz_enable_body_tracking ( int cameraID , ref BodyTrackingParameters bt_params ) ;
740743
@@ -2436,6 +2439,22 @@ public float GetDepthValue(Vector3 pixel)
24362439 return d ;
24372440 }
24382441
2442+ /// <summary>
2443+ /// Gets the current depth value of a pixel in the UNITS specified when the camera was started with Init().
2444+ /// <param name="position">The pixel's coordinates of the ZED Image as a Vector2.
2445+ /// <returns>Depth value as a float.</returns>
2446+ /// </summary>
2447+ public float GetDepthValue ( Vector2 pixel )
2448+ {
2449+ if ( ! cameraReady )
2450+ {
2451+ return - 1 ;
2452+ }
2453+
2454+ float d = dllz_get_depth_value ( CameraID , ( uint ) pixel . x , ( uint ) pixel . y ) ;
2455+ return d ;
2456+ }
2457+
24392458 /// <summary>
24402459 /// Gets the current Euclidean distance (sqrt(x²+y²+z²)) of the targeted pixel of the screen to the camera.
24412460 /// May result in errors if the ZED image does not fill the whole screen.
@@ -3104,13 +3123,157 @@ public sl.ERROR_CODE IngestCustomBoxObjects(List<CustomBoxObjectData> objects_in
31043123 /// Retrieve object detection data
31053124 /// </summary>
31063125 /// <param name="od_params"> Object detection runtime parameters</param>
3107- /// <param name="objFrame"> ObjectsFrameSDK that contains all the detection data</param>
3126+ /// <param name="objFrame"> Objects that contains all the detection data</param>
3127+ /// <param name="instanceID"> Id of the object detection instance. Used when multiple instances of the object detection module are enabled at the same time. </param>
31083128 /// <returns></returns>
31093129 public sl . ERROR_CODE RetrieveObjects ( ref ObjectDetectionRuntimeParameters od_params , ref Objects objFrame , uint instanceID = 0 )
31103130 {
31113131 return ( sl . ERROR_CODE ) dllz_retrieve_objects_data ( CameraID , ref od_params , ref objFrame , instanceID ) ;
31123132 }
31133133
3134+ [ StructLayout ( LayoutKind . Sequential ) ]
3135+ public struct dll_customObjectDetectionProperties
3136+ {
3137+ /// <summary>
3138+ /// Index of the class represented by this set of properties.
3139+ /// </summary>
3140+ public int classID ;
3141+
3142+ /// <summary>
3143+ /// Whether the object object is kept or not.
3144+ /// </summary>
3145+ [ MarshalAs ( UnmanagedType . U1 ) ]
3146+ public bool enabled ;
3147+ /// <summary>
3148+ /// Confidence threshold.
3149+ /// From 1 to 100, with 1 meaning a low threshold, more uncertain objects and 99 very few but very precise objects.
3150+ /// If the scene contains a lot of objects, increasing the confidence can slightly speed up the process, since every object instance is tracked.
3151+ /// Default: 20.f
3152+ /// </summary>
3153+ public float detectionConfidenceThreshold ;
3154+
3155+ /// <summary>
3156+ /// Provide hypothesis about the object movements(degrees of freedom or DoF) to improve the object tracking.
3157+ /// - true: 2 DoF projected alongside the floor plane. Case for object standing on the ground such as person, vehicle, etc.
3158+ /// The projection implies that the objects cannot be superposed on multiple horizontal levels.
3159+ /// - false: 6 DoF (full 3D movements are allowed).
3160+ /// This parameter cannot be changed for a given object tracking id.
3161+ /// It is advised to set it by labels to avoid issues.
3162+ /// </summary>
3163+ [ MarshalAs ( UnmanagedType . U1 ) ]
3164+ public bool isGrounded ;
3165+
3166+ /// <summary>
3167+ /// Provide hypothesis about the object staticity to improve the object tracking.
3168+ /// - true: the object will be assumed to never move nor being moved.
3169+ /// - false: the object will be assumed to be able to move or being moved.
3170+ /// </summary>
3171+ [ MarshalAs ( UnmanagedType . U1 ) ]
3172+ public bool isStatic ;
3173+
3174+ /// <summary>
3175+ /// Maximum tracking time threshold (in seconds) before dropping the tracked object when unseen for this amount of time.
3176+ /// By default, let the tracker decide internally based on the internal sub class of the tracked object.
3177+ /// Only valid for static object.
3178+ /// </summary>
3179+ public float trackingTimeout ;
3180+
3181+ /// <summary>
3182+ /// Maximum tracking distance threshold (in meters) before dropping the tracked object when unseen for this amount of meters.
3183+ /// By default, do not discard tracked object based on distance.
3184+ /// Only valid for static object.
3185+ /// </summary>
3186+ public float trackingMaxDist ;
3187+
3188+ /// <summary>
3189+ /// Maximum allowed width normalized to the image size.
3190+ /// Any prediction bigger than that will be filtered out.
3191+ /// Default: -1 (no filtering)
3192+ /// </summary>
3193+ public float maxBoxWidthNormalized ;
3194+
3195+ /// <summary>
3196+ /// Minimum allowed width normalized to the image size.
3197+ /// Any prediction smaller than that will be filtered out.
3198+ /// Default: -1 (no filtering)
3199+ /// </summary>
3200+ public float minBoxWidthNormalized ;
3201+
3202+ /// <summary>
3203+ /// Maximum allowed height normalized to the image size.
3204+ /// Any prediction bigger than that will be filtered out.
3205+ /// Default: -1 (no filtering)
3206+ /// </summary>
3207+ public float maxBoxHeightNormalized ;
3208+
3209+ /// <summary>
3210+ /// Minimum allowed Height normalized to the image size.
3211+ /// Any prediction smaller than that will be filtered out.
3212+ /// Default: -1 (no filtering)
3213+ /// </summary>
3214+ public float minBoxHeightNormalized ;
3215+
3216+ public dll_customObjectDetectionProperties ( CustomObjectDetectionProperties customObjectDetectionProperties )
3217+ {
3218+ classID = customObjectDetectionProperties . classID ;
3219+ enabled = customObjectDetectionProperties . enabled ;
3220+ detectionConfidenceThreshold = customObjectDetectionProperties . detectionConfidenceThreshold ;
3221+ isGrounded = customObjectDetectionProperties . isGrounded ;
3222+ isStatic = customObjectDetectionProperties . isStatic ;
3223+ trackingTimeout = customObjectDetectionProperties . trackingTimeout ;
3224+ trackingMaxDist = customObjectDetectionProperties . trackingMaxDist ;
3225+ maxBoxWidthNormalized = customObjectDetectionProperties . maxBoxWidthNormalized ;
3226+ minBoxWidthNormalized = customObjectDetectionProperties . minBoxWidthNormalized ;
3227+ maxBoxHeightNormalized = customObjectDetectionProperties . maxBoxHeightNormalized ;
3228+ minBoxHeightNormalized = customObjectDetectionProperties . minBoxHeightNormalized ;
3229+ }
3230+ } ;
3231+
3232+ /// <summary>
3233+ /// DLL-friendly version of CustomObjectDetectionRuntimeParameters (found in ZEDCommon.cs).
3234+ /// </summary>
3235+ [ StructLayout ( LayoutKind . Sequential ) ]
3236+ struct dll_customObjectDetectionRuntimeParameters
3237+ {
3238+ /// <summary>
3239+ /// Global object detection properties.
3240+ /// objectDetectionProperties is used as a fallback when CustomObjectDetectionRuntimeParameters.objectClassDetectionProperties is partially set.
3241+ /// </summary>
3242+ public dll_customObjectDetectionProperties objectDetectionProperties ;
3243+
3244+ /// <summary>
3245+ /// Per class object detection properties.
3246+ /// </summary>
3247+ public IntPtr objectClassDetectionProperties ;
3248+
3249+ /// <summary>
3250+ /// Size of the \ref objectClassDetectionProperties array.
3251+ /// </summary>
3252+ public uint numberCustomDetectionProperties ;
3253+
3254+ public dll_customObjectDetectionRuntimeParameters ( CustomObjectDetectionRuntimeParameters customObjectDetectionRuntimeParameters )
3255+ {
3256+ objectDetectionProperties = new dll_customObjectDetectionProperties ( customObjectDetectionRuntimeParameters . objectDetectionProperties ) ;
3257+ numberCustomDetectionProperties = ( uint ) customObjectDetectionRuntimeParameters . objectClassDetectionProperties . Count ;
3258+ objectClassDetectionProperties = Marshal . AllocHGlobal ( customObjectDetectionRuntimeParameters . objectClassDetectionProperties . Count * Marshal . SizeOf ( typeof ( dll_customObjectDetectionProperties ) ) ) ;
3259+ }
3260+ } ;
3261+
3262+ /// <summary>
3263+ /// Retrieve object detection data from custom object detection
3264+ /// </summary>
3265+ /// <param name="objectDetectionRuntimeParameters"> Custim object detection runtime parameters</param>
3266+ /// <param name="objFrame">Objects that contains all the detection data</param>
3267+ /// <param name="instanceID"> Id of the object detection instance. Used when multiple instances of the object detection module are enabled at the same time. </param>
3268+ /// <returns></returns>
3269+ public sl . ERROR_CODE RetrieveObjects ( ref CustomObjectDetectionRuntimeParameters objectDetectionRuntimeParameters , ref Objects objFrame , uint instanceID = 0 )
3270+ {
3271+ dll_customObjectDetectionRuntimeParameters dll_CustomObjectDetectionRuntime = new dll_customObjectDetectionRuntimeParameters ( objectDetectionRuntimeParameters ) ;
3272+ var e = ( sl . ERROR_CODE ) dllz_retrieve_custom_objects ( CameraID , ref dll_CustomObjectDetectionRuntime , ref objFrame , instanceID ) ;
3273+ Marshal . FreeHGlobal ( dll_CustomObjectDetectionRuntime . objectClassDetectionProperties ) ;
3274+ return e ;
3275+ }
3276+
31143277 /// <summary>
31153278 /// Update the batch trajectories and retrieve the number of batches.
31163279 /// </summary>
@@ -3209,6 +3372,7 @@ public void DisableBodyTracking(uint bodyTrackingInstanceID = 1)
32093372 /// </summary>
32103373 /// <param name="body_params"> Body Tracking runtime parameters</param>
32113374 /// <param name="bodies"> Bodies that contains all the detection data</param>
3375+ /// <param name="instanceID"> Id of the object detection instance. Used when multiple instances of the object detection module are enabled at the same time. </param>
32123376 /// <returns></returns>
32133377 public sl . ERROR_CODE RetrieveBodies ( ref BodyTrackingRuntimeParameters bt_params , ref Bodies bodies , uint instanceID = 0 )
32143378 {
0 commit comments