Skip to content

Commit 22ceec7

Browse files
authored
Update to ZED SDK 4.2.x (#3)
1 parent ff7594e commit 22ceec7

25 files changed

+612
-39
lines changed

.github/workflows/build-natives.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
build-linux-x86_64:
1313
runs-on: [self-hosted, ihmc-runner-nvidia]
1414
container:
15-
image: stereolabs/zed:4.1-devel-cuda12.1-ubuntu20.04
15+
image: stereolabs/zed:4.2-devel-cuda12.1-ubuntu20.04
1616
steps:
1717
- name: Install dependencies
1818
run: |
@@ -37,7 +37,7 @@ jobs:
3737
build-linux-l4t:
3838
runs-on: [self-hosted, ihmc-runner-nvidia]
3939
container:
40-
image: stereolabs/zed:4.1-devel-l4t-r35.3
40+
image: stereolabs/zed:4.2-devel-l4t-r35.3
4141
needs: [build-linux-x86_64]
4242
steps:
4343
- name: Install dependencies
@@ -100,8 +100,8 @@ jobs:
100100
- name: Install dependencies
101101
run: |
102102
python -m pip install gdown
103-
gdown https://drive.google.com/uc?id=1m_FVVQPPe2D7HCYL4htLuAcZRN64H1OB
104-
tar -xvf ZEDSDK-Windows-4.1.3.tar.gz -C "C:\\Program Files (x86)"
103+
gdown https://drive.google.com/uc?id=1uDEVu8hOGVJdnO_GEVWJu25QJmdcuxn-
104+
tar -xvf ZEDSDK-Windows-4.2.1.tar.gz -C "C:\\Program Files (x86)"
105105
- uses: ilammy/msvc-dev-cmd@v1
106106
with:
107107
vsversion: 2019

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# zed-java-api
22
zed-java-api provides Java JNI bindings for ZED SDK. The bindings are based on [zed-c-api](https://github.com/stereolabs/zed-c-api).
33

4-
Currently compatible with ZED SDK **4.1.x**.
4+
Currently compatible with ZED SDK **4.2.x**.
55

66
Allows you to use Stereolabs sensors such as ZED 2, ZED 2i, ZED X, ZED Mini, ZED X Mini from Java.
77
## Usage
@@ -16,7 +16,7 @@ Requires Java 17.
1616
### Gradle
1717
```
1818
dependencies {
19-
implementation("us.ihmc:zed-java-api:4.1.4")
19+
implementation("us.ihmc:zed-java-api:4.2.0")
2020
}
2121
```
2222
### Maven
@@ -25,7 +25,7 @@ dependencies {
2525
<dependency>
2626
<groupId>us.ihmc</groupId>
2727
<artifactId>zed-java-api</artifactId>
28-
<version>4.1.4</version>
28+
<version>4.2.0</version>
2929
</dependency>
3030
</dependencies>
3131
```

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "us.ihmc"
7-
version = "4.1.4"
7+
version = "4.2.0"
88

99
repositories {
1010
mavenCentral()

cppbuild.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pushd .
44
mkdir cppbuild
55
cd cppbuild
66

7-
ZED_C_API_VERSION=4.1.0
7+
ZED_C_API_VERSION=4.2.0
88
if [ ! -f "zed-c-api.tar.gz" ]; then
99
curl -o zed-c-api.tar.gz https://codeload.github.com/stereolabs/zed-c-api/tar.gz/refs/tags/v$ZED_C_API_VERSION
1010
fi

src/main/java/us/ihmc/zed/SL_Bodies.java

+9
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ public class SL_Bodies extends Pointer {
5454
*/
5555
public native int is_tracked(); public native SL_Bodies is_tracked(int setter);
5656
/**
57+
\brief Status of the actual inference precision mode used to detect the bodies/persons.
58+
\note It depends on the GPU hardware support, the sl::BodyTrackingParameters.allow_reduced_precision_inference input parameter and the model support.
59+
*/
60+
public native @Cast("SL_INFERENCE_PRECISION") int inference_precision_mode(); public native SL_Bodies inference_precision_mode(int setter);
61+
/**
62+
\brief Body format used in sl::BodyTrackingParameters.body_format parameter.
63+
*/
64+
public native @Cast("SL_BODY_FORMAT") int body_format(); public native SL_Bodies body_format(int setter);
65+
/**
5766
\brief Array of bodies/persons.
5867
\note Since the data is transmitted from C++ to C, the size of the structure must be constant.
5968
\note Therefore, there is a limitation of 75 objects in the image.

src/main/java/us/ihmc/zed/SL_CustomBoxObjectData.java

+23-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public class SL_CustomBoxObjectData extends Pointer {
3636

3737
/**
3838
\brief Unique id to help identify and track AI detections.
39-
<p>
40-
It can be either generated externally, or by using \ref sl_generate_unique_id() or left empty.
39+
<p>
40+
It can be either generated externally, or by using \ref sl_generate_unique_id() or left empty.
4141
*/
4242
public native @Cast("char") byte unique_object_id(int i); public native SL_CustomBoxObjectData unique_object_id(int i, byte setter);
4343
@MemberGetter public native @Cast("char*") BytePointer unique_object_id();
@@ -77,4 +77,25 @@ public class SL_CustomBoxObjectData extends Pointer {
7777
\note It is advised to set it by labels to avoid issues.
7878
*/
7979
public native @Cast("bool") boolean is_grounded(); public native SL_CustomBoxObjectData is_grounded(boolean setter);
80+
81+
/**
82+
\brief Provide hypothesis about the object staticity to improve the object tracking.
83+
- true: the object will be assumed to never move nor being moved.
84+
- false: the object will be assumed to be able to move or being moved.
85+
*/
86+
public native @Cast("bool") boolean is_static(); public native SL_CustomBoxObjectData is_static(boolean setter);
87+
88+
/**
89+
\brief Maximum tracking time threshold (in seconds) before dropping the tracked object when unseen for this amount of time.
90+
By default, let the tracker decide internally based on the internal sub class of the tracked object.
91+
Only valid for static object.
92+
*/
93+
public native float tracking_timeout(); public native SL_CustomBoxObjectData tracking_timeout(float setter);
94+
95+
/**
96+
\brief Maximum tracking distance threshold (in meters) before dropping the tracked object when unseen for this amount of meters.
97+
By default, do not discard tracked object based on distance.
98+
Only valid for static object.
99+
*/
100+
public native float tracking_max_dist(); public native SL_CustomBoxObjectData tracking_max_dist(float setter);
80101
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// Targeted by JavaCPP version 1.5.10: DO NOT EDIT THIS FILE
2+
3+
package us.ihmc.zed;
4+
5+
import org.bytedeco.cuda.cudart.CUctx_st;
6+
import org.bytedeco.cuda.cudart.CUstream_st;
7+
import java.nio.*;
8+
import org.bytedeco.javacpp.*;
9+
import org.bytedeco.javacpp.annotation.*;
10+
11+
import static us.ihmc.zed.global.zed.*;
12+
13+
14+
@Properties(inherit = us.ihmc.zed.ZEDJavaAPIConfig.class)
15+
public class SL_CustomMaskObjectData extends Pointer {
16+
static { Loader.load(); }
17+
/** Default native constructor. */
18+
public SL_CustomMaskObjectData() { super((Pointer)null); allocate(); }
19+
/** Native array allocator. Access with {@link Pointer#position(long)}. */
20+
public SL_CustomMaskObjectData(long size) { super((Pointer)null); allocateArray(size); }
21+
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
22+
public SL_CustomMaskObjectData(Pointer p) { super(p); }
23+
private native void allocate();
24+
private native void allocateArray(long size);
25+
@Override public SL_CustomMaskObjectData position(long position) {
26+
return (SL_CustomMaskObjectData)super.position(position);
27+
}
28+
@Override public SL_CustomMaskObjectData getPointer(long i) {
29+
return new SL_CustomMaskObjectData((Pointer)this).offsetAddress(i);
30+
}
31+
32+
/**
33+
\brief Unique id to help identify and track AI detections.
34+
<p>
35+
It can be either generated externally, or by using \ref sl_generate_unique_id() or left empty.
36+
*/
37+
public native @Cast("char") byte unique_object_id(int i); public native SL_CustomMaskObjectData unique_object_id(int i, byte setter);
38+
@MemberGetter public native @Cast("char*") BytePointer unique_object_id();
39+
/**
40+
\brief 2D bounding box of the object represented as four 2D points starting at the top left corner and rotation clockwise.
41+
\note Expressed in pixels on the original image resolution, <pre>{@code [0, 0]}</pre> is the top left corner.
42+
<pre>{@code
43+
A ------ B
44+
| Object |
45+
D ------ C
46+
}</pre>
47+
*/
48+
public native @ByRef SL_Vector2 bounding_box_2d(int i); public native SL_CustomMaskObjectData bounding_box_2d(int i, SL_Vector2 setter);
49+
@MemberGetter public native SL_Vector2 bounding_box_2d();
50+
51+
/**
52+
\brief Object label.
53+
<p>
54+
This information is passed-through and can be used to improve object tracking.
55+
\note It should define an object class. This means that any similar object (in classification) should share the same label number.
56+
*/
57+
public native int label(); public native SL_CustomMaskObjectData label(int setter);
58+
59+
/**
60+
\brief Detection confidence value of the object.
61+
\note The value should be in <pre>{@code [0-1]}</pre>.
62+
\note It can be used to improve the object tracking.
63+
*/
64+
public native float probability(); public native SL_CustomMaskObjectData probability(float setter);
65+
/**
66+
\brief Provide hypothesis about the object movements (degrees of freedom or DoF) to improve the object tracking.
67+
- true: 2 DoF projected alongside the floor plane. Case for object standing on the ground such as person, vehicle, etc.
68+
\n The projection implies that the objects cannot be superposed on multiple horizontal levels.
69+
- false: 6 DoF (full 3D movements are allowed).
70+
<p>
71+
\note This parameter cannot be changed for a given object tracking id.
72+
\note It is advised to set it by labels to avoid issues.
73+
*/
74+
public native @Cast("bool") boolean is_grounded(); public native SL_CustomMaskObjectData is_grounded(boolean setter);
75+
76+
/**
77+
\brief Provide hypothesis about the object staticity to improve the object tracking.
78+
- true: the object will be assumed to never move nor being moved.
79+
- false: the object will be assumed to be able to move or being moved.
80+
*/
81+
public native @Cast("bool") boolean is_static(); public native SL_CustomMaskObjectData is_static(boolean setter);
82+
83+
/**
84+
\brief Maximum tracking time threshold (in seconds) before dropping the tracked object when unseen for this amount of time.
85+
By default, let the tracker decide internally based on the internal sub class of the tracked object.
86+
Only valid for static object.
87+
*/
88+
public native float tracking_timeout(); public native SL_CustomMaskObjectData tracking_timeout(float setter);
89+
90+
/**
91+
\brief Maximum tracking distance threshold (in meters) before dropping the tracked object when unseen for this amount of meters.
92+
By default, do not discard tracked object based on distance.
93+
Only valid for static object.
94+
*/
95+
public native float tracking_max_dist(); public native SL_CustomMaskObjectData tracking_max_dist(float setter);
96+
97+
/**
98+
\brief 2D mask of the object inside its bounding box.
99+
*/
100+
public native @Cast("unsigned char*") BytePointer box_mask(); public native SL_CustomMaskObjectData box_mask(BytePointer setter);
101+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// Targeted by JavaCPP version 1.5.10: DO NOT EDIT THIS FILE
2+
3+
package us.ihmc.zed;
4+
5+
import org.bytedeco.cuda.cudart.CUctx_st;
6+
import org.bytedeco.cuda.cudart.CUstream_st;
7+
import java.nio.*;
8+
import org.bytedeco.javacpp.*;
9+
import org.bytedeco.javacpp.annotation.*;
10+
11+
import static us.ihmc.zed.global.zed.*;
12+
13+
14+
/**
15+
\brief Structure containing a set of runtime properties of a certain class ID for the object detection module using a custom model.
16+
<p>
17+
The default constructor sets all parameters to their default settings.
18+
\note Parameters can be adjusted by the user.
19+
*/
20+
@Properties(inherit = us.ihmc.zed.ZEDJavaAPIConfig.class)
21+
public class SL_CustomObjectDetectionProperties extends Pointer {
22+
static { Loader.load(); }
23+
/** Default native constructor. */
24+
public SL_CustomObjectDetectionProperties() { super((Pointer)null); allocate(); }
25+
/** Native array allocator. Access with {@link Pointer#position(long)}. */
26+
public SL_CustomObjectDetectionProperties(long size) { super((Pointer)null); allocateArray(size); }
27+
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
28+
public SL_CustomObjectDetectionProperties(Pointer p) { super(p); }
29+
private native void allocate();
30+
private native void allocateArray(long size);
31+
@Override public SL_CustomObjectDetectionProperties position(long position) {
32+
return (SL_CustomObjectDetectionProperties)super.position(position);
33+
}
34+
@Override public SL_CustomObjectDetectionProperties getPointer(long i) {
35+
return new SL_CustomObjectDetectionProperties((Pointer)this).offsetAddress(i);
36+
}
37+
38+
/**
39+
\brief Index of the class represented by this set of properties.
40+
*/
41+
public native int class_id(); public native SL_CustomObjectDetectionProperties class_id(int setter);
42+
43+
/**
44+
\brief Whether the object object is kept or not.
45+
*/
46+
public native @Cast("bool") boolean enabled(); public native SL_CustomObjectDetectionProperties enabled(boolean setter);
47+
48+
/**
49+
\brief Confidence threshold.
50+
<p>
51+
From 1 to 100, with 1 meaning a low threshold, more uncertain objects and 99 very few but very precise objects.
52+
\n Default: 20.f
53+
\note If the scene contains a lot of objects, increasing the confidence can slightly speed up the process, since every object instance is tracked.
54+
*/
55+
public native float detection_confidence_threshold(); public native SL_CustomObjectDetectionProperties detection_confidence_threshold(float setter);
56+
57+
/**
58+
\brief Provide hypothesis about the object movements (degrees of freedom or DoF) to improve the object tracking.
59+
- true: 2 DoF projected alongside the floor plane. Case for object standing on the ground such as person, vehicle, etc.
60+
\n The projection implies that the objects cannot be superposed on multiple horizontal levels.
61+
- false: 6 DoF (full 3D movements are allowed).
62+
<p>
63+
\note This parameter cannot be changed for a given object tracking id.
64+
\note It is advised to set it by labels to avoid issues.
65+
*/
66+
public native @Cast("bool") boolean is_grounded(); public native SL_CustomObjectDetectionProperties is_grounded(boolean setter);
67+
68+
/**
69+
\brief Provide hypothesis about the object staticity to improve the object tracking.
70+
- true: the object will be assumed to never move nor being moved.
71+
- false: the object will be assumed to be able to move or being moved.
72+
*/
73+
public native @Cast("bool") boolean is_static(); public native SL_CustomObjectDetectionProperties is_static(boolean setter);
74+
75+
/**
76+
\brief Maximum tracking time threshold (in seconds) before dropping the tracked object when unseen for this amount of time.
77+
<p>
78+
By default, let the tracker decide internally based on the internal sub class of the tracked object.
79+
Only valid for static object.
80+
*/
81+
public native float tracking_timeout(); public native SL_CustomObjectDetectionProperties tracking_timeout(float setter);
82+
83+
/**
84+
\brief Maximum tracking distance threshold (in meters) before dropping the tracked object when unseen for this amount of meters.
85+
<p>
86+
By default, do not discard tracked object based on distance.
87+
Only valid for static object.
88+
*/
89+
public native float tracking_max_dist(); public native SL_CustomObjectDetectionProperties tracking_max_dist(float setter);
90+
91+
/**
92+
\brief Maximum allowed width normalized to the image size.
93+
<p>
94+
Any prediction bigger than that will be filtered out.
95+
Default: -1 (no filtering)
96+
*/
97+
public native float max_box_width_normalized(); public native SL_CustomObjectDetectionProperties max_box_width_normalized(float setter);
98+
99+
/**
100+
\brief Minimum allowed width normalized to the image size.
101+
<p>
102+
Any prediction smaller than that will be filtered out.
103+
Default: -1 (no filtering)
104+
*/
105+
public native float min_box_width_normalized(); public native SL_CustomObjectDetectionProperties min_box_width_normalized(float setter);
106+
107+
/**
108+
\brief Maximum allowed height normalized to the image size.
109+
<p>
110+
Any prediction bigger than that will be filtered out.
111+
Default: -1 (no filtering)
112+
*/
113+
public native float max_box_height_normalized(); public native SL_CustomObjectDetectionProperties max_box_height_normalized(float setter);
114+
115+
/**
116+
\brief Minimum allowed height normalized to the image size.
117+
<p>
118+
Any prediction smaller than that will be filtered out.
119+
Default: -1 (no filtering)
120+
*/
121+
public native float min_box_height_normalized(); public native SL_CustomObjectDetectionProperties min_box_height_normalized(float setter);
122+
}

0 commit comments

Comments
 (0)