You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -68,7 +68,7 @@ The SDK MetaData library is developed in C/C++. Python bindings provide access t
68
68
```
69
69
70
70
Applications can import the module thus:
71
-
```
71
+
```python
72
72
import sys
73
73
sys.path.append('../') # Add path to the bindings directory
74
74
# The common/is_aarch64.py module adds the platform-specific path to pyds module
@@ -88,16 +88,16 @@ When MetaData objects are allocated in Python, an allocation function is provide
88
88
89
89
Example:
90
90
To allocate an NvDsEventMsgMeta instance, use this:
91
-
```
91
+
```python
92
92
msg_meta = pyds.alloc_nvds_event_msg_meta() # get reference to allocated instance without claiming memory ownership
93
93
```
94
94
NOT this:
95
-
```
95
+
```python
96
96
msg_meta = NvDsEventMsgMeta() # memory will be freed by the garbage collector when msg_meta goes out of scope in Python
97
97
```
98
98
99
99
Allocators are available for the following structs:
100
-
```
100
+
```python
101
101
NvDsVehicleObject: alloc_nvds_vehicle_object()
102
102
NvDsPersonObject: alloc_nvds_person_object()
103
103
NvDsFaceObject: alloc_nvds_face_object()
@@ -120,21 +120,21 @@ This memory is owned by the C code and will be freed later. To free the buffer i
120
120
121
121
##### Reading String Fields
122
122
Directly reading a string field returns C address of the field in the form of an int, e.g.:
123
-
```
123
+
```python
124
124
obj = pyds.glist_get_nvds_vehicle_object(data);
125
125
print(obj.type)
126
126
```
127
127
This will print an int representing the address of obj.type in C (which is a char*).
128
128
129
129
To retrieve the string value of this field, use ```pyds.get_string()```, e.g.:
130
-
```
130
+
```python
131
131
print(pyds.get_string(obj.type))
132
132
```
133
133
134
134
#### Casting
135
135
136
136
Some MetaData instances are stored in GList form. To access the data in a GList node, the data field needs to be cast to the appropriate structure. This casting is done via binding functions:
Custom MetaData added to NvDsUserMeta require custom copy and release functions. The MetaData library relies on these custom functions to perform deep-copy of the custom structure, and free allocated resources. These functions are registered as callback function pointers in the NvDsUserMeta structure.
160
160
161
161
Callback functions are registered using these functions:
0 commit comments