Skip to content

Commit 1239d08

Browse files
committed
4.0.6
1 parent 7797605 commit 1239d08

4 files changed

Lines changed: 777 additions & 139 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This package lets you use the ZED stereo camera in C#. The C# API is a wrapper a
1414
- Visual Studio 2017 with C# extensions
1515
- Cmake 3.23 at least
1616
- [C wrapper](https://github.com/stereolabs/zed-c-api) of the ZED SDK
17-
- [ZED SDK **4.0.5**](https://www.stereolabs.com/developers/release/) and its dependency ([CUDA](https://developer.nvidia.com/cuda-downloads))
17+
- [ZED SDK **4.0.6**](https://www.stereolabs.com/developers/release/) and its dependency ([CUDA](https://developer.nvidia.com/cuda-downloads))
1818

1919
## From NuGet
2020

Stereolabs.zed/src/ZEDCamera.cs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ public bool IsCameraReady
482482
private static extern IntPtr dllz_find_floor_plane(int cameraID, out Quaternion rotation, out Vector3 translation, Quaternion priorQuaternion, Vector3 priorTranslation);
483483

484484
[DllImport(nameDll, EntryPoint = "sl_find_plane_at_hit")]
485-
private static extern IntPtr dllz_find_plane_at_hit(int cameraID, Vector2 HitPixel, bool refine);
485+
private static extern IntPtr dllz_find_plane_at_hit(int cameraID, Vector2 HitPixel, ref sl_PlaneDetectionParameters plane_params, bool refine);
486486

487487
[DllImport(nameDll, EntryPoint = "sl_convert_floorplane_to_mesh")]
488488
private static extern int dllz_convert_floorplane_to_mesh(int cameraID, [In, Out] Vector3[] vertices, int[] triangles, out int numVertices, out int numTriangles);
@@ -780,7 +780,6 @@ struct sl_initParameters
780780
/// </summary>
781781
public float grabComputeCappingFPS;
782782

783-
784783
/// <summary>
785784
/// Copy constructor.
786785
/// </summary>
@@ -902,6 +901,16 @@ struct sl_SpatialMappingParameters
902901
public int stabilityCounter;
903902
};
904903

904+
/// <summary>
905+
/// DLL-friendly version of PlaneDetectionParameters (found in ZEDCommon.cs).
906+
/// </summary>
907+
[StructLayout(LayoutKind.Sequential)]
908+
struct sl_PlaneDetectionParameters
909+
{
910+
public float maxDistanceThreshold;
911+
public float normalSimilarityThreshold;
912+
};
913+
905914
/// <summary>
906915
/// Checks if the ZED camera is plugged in and opens it.
907916
/// </summary>
@@ -1042,7 +1051,6 @@ public InitParameters GetInitParameters()
10421051
openTimeoutSec = sl_parameters.openTimeoutSec,
10431052
asyncGrabCameraRecovery = sl_parameters.asyncGrabCameraRecovery,
10441053
grabComputeCappingFPS = sl_parameters.grabComputeCappingFPS
1045-
10461054
};
10471055
return parameters;
10481056
}
@@ -1726,7 +1734,7 @@ public ERROR_CODE GetSensorsData(ref SensorsData data, TIME_REFERENCE referenceT
17261734
/// <summary>
17271735
/// Defines a region of interest to focus on for all the SDK, discarding other parts.
17281736
/// </summary>
1729-
/// <param name="roiMask">the Mat defining the requested region of interest, all pixel set to 0 will be discard. If empty, set all pixels as valid, otherwise should fit the resolution of the current instance and its type should be U8_C1.</param>
1737+
/// <param name="roiMask">the Mat defining the requested region of interest, pixels lower than 127 will be discard. If empty, set all pixels as valid, otherwise should fit the resolution of the current instance and its type should be U8_C1/C3/C4.</param>
17301738
/// <returns></returns>
17311739
public ERROR_CODE SetRegionOfInterest(sl.Mat roiMask)
17321740
{
@@ -2273,13 +2281,17 @@ public int ConvertFloorPlaneToMesh(Vector3[] vertices, int[] triangles, out int
22732281
/// <param name="screenPos">Point on the ZED image to check for a plane.</param>
22742282
/// <returns></returns>
22752283
[Obsolete("This Method is Deprecated, use FindPlaneAtHit instead", false)]
2276-
public sl.ERROR_CODE findPlaneAtHit(ref PlaneData plane, Vector2 coord)
2284+
public sl.ERROR_CODE findPlaneAtHit(ref PlaneData plane, Vector2 coord, ref PlaneDetectionParameters planeDetectionParameters)
22772285
{
22782286
IntPtr p = IntPtr.Zero;
22792287
Quaternion out_quat = Quaternion.Identity;
22802288
Vector3 out_trans = Vector3.Zero;
22812289

2282-
p = dllz_find_plane_at_hit(CameraID, coord, false);
2290+
sl_PlaneDetectionParameters plane_params = new sl_PlaneDetectionParameters();
2291+
plane_params.maxDistanceThreshold = planeDetectionParameters.maxDistanceThreshold;
2292+
plane_params.normalSimilarityThreshold= planeDetectionParameters.normalSimilarityThreshold;
2293+
2294+
p = dllz_find_plane_at_hit(CameraID, coord, ref plane_params, false);
22832295
plane.Bounds = new Vector3[256];
22842296

22852297
if (p != IntPtr.Zero)
@@ -2297,13 +2309,17 @@ public sl.ERROR_CODE findPlaneAtHit(ref PlaneData plane, Vector2 coord)
22972309
/// <param name="plane">Data on the detected plane.</param>
22982310
/// <param name="screenPos">Point on the ZED image to check for a plane.</param>
22992311
/// <returns></returns>
2300-
public sl.ERROR_CODE FindPlaneAtHit(ref PlaneData plane, Vector2 coord)
2312+
public sl.ERROR_CODE FindPlaneAtHit(ref PlaneData plane, Vector2 coord, ref PlaneDetectionParameters planeDetectionParameters)
23012313
{
23022314
IntPtr p = IntPtr.Zero;
23032315
Quaternion out_quat = Quaternion.Identity;
23042316
Vector3 out_trans = Vector3.Zero;
23052317

2306-
p = dllz_find_plane_at_hit(CameraID, coord, false);
2318+
sl_PlaneDetectionParameters plane_params = new sl_PlaneDetectionParameters();
2319+
plane_params.maxDistanceThreshold = planeDetectionParameters.maxDistanceThreshold;
2320+
plane_params.normalSimilarityThreshold = planeDetectionParameters.normalSimilarityThreshold;
2321+
2322+
p = dllz_find_plane_at_hit(CameraID, coord, ref plane_params, false);
23072323
plane.Bounds = new Vector3[256];
23082324

23092325
if (p != IntPtr.Zero)

0 commit comments

Comments
 (0)