Skip to content

Commit 317db92

Browse files
authored
Update HOWTO.md
- Add link to SDK - Show code blocks with python syntax highlighting
1 parent ff1ebdb commit 317db92

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

HOWTO.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This guide provides resources for DeepStream application development in Python.
1414
## Prerequisites
1515

1616
* Ubuntu 18.04
17-
* DeepStream SDK 4.0.1
17+
* [DeepStream SDK 4.0.1](https://developer.nvidia.com/deepstream-download) or later
1818
* Python 3
1919
* [Gst Python](https://gstreamer.freedesktop.org/modules/gst-python.html) v1.14.5
2020

@@ -68,7 +68,7 @@ The SDK MetaData library is developed in C/C++. Python bindings provide access t
6868
```
6969

7070
Applications can import the module thus:
71-
```
71+
```python
7272
import sys
7373
sys.path.append('../') # Add path to the bindings directory
7474
# 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
8888

8989
Example:
9090
To allocate an NvDsEventMsgMeta instance, use this:
91-
```
91+
```python
9292
msg_meta = pyds.alloc_nvds_event_msg_meta() # get reference to allocated instance without claiming memory ownership
9393
```
9494
NOT this:
95-
```
95+
```python
9696
msg_meta = NvDsEventMsgMeta() # memory will be freed by the garbage collector when msg_meta goes out of scope in Python
9797
```
9898

9999
Allocators are available for the following structs:
100-
```
100+
```python
101101
NvDsVehicleObject: alloc_nvds_vehicle_object()
102102
NvDsPersonObject: alloc_nvds_person_object()
103103
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
120120

121121
##### Reading String Fields
122122
Directly reading a string field returns C address of the field in the form of an int, e.g.:
123-
```
123+
```python
124124
obj = pyds.glist_get_nvds_vehicle_object(data);
125125
print(obj.type)
126126
```
127127
This will print an int representing the address of obj.type in C (which is a char*).
128128

129129
To retrieve the string value of this field, use ```pyds.get_string()```, e.g.:
130-
```
130+
```python
131131
print(pyds.get_string(obj.type))
132132
```
133133

134134
#### Casting
135135

136136
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:
137-
```
137+
```python
138138
glist_get_nvds_batch_meta
139139
glist_get_nvds_frame_meta
140140
glist_get_nvds_object_meta
@@ -149,7 +149,7 @@ glist_get_nvds_person_object
149149
```
150150

151151
Example:
152-
```
152+
```python
153153
l_frame = batch_meta.frame_meta_list
154154
frame_meta = pyds.glist_get_nvds_frame_meta(l_frame.data)
155155
```
@@ -159,7 +159,7 @@ frame_meta = pyds.glist_get_nvds_frame_meta(l_frame.data)
159159
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.
160160

161161
Callback functions are registered using these functions:
162-
```
162+
```python
163163
pyds.set_user_copyfunc(NvDsUserMeta_instance, copy_function)
164164
pyds.set_user_releasefunc(NvDsUserMeta_instance, free_func)
165165
```
@@ -180,7 +180,7 @@ The following optimized functions are available:
180180
##### pyds.NvOSD_ColorParams.set(double red, double green, double blue, double alpha)
181181

182182
This is a simple function that performs the same operations as the following:
183-
```
183+
```python
184184
txt_params.text_bg_clr.red = red
185185
txt_params.text_bg_clr.green = green
186186
txt_params.text_bg_clr.blue = blue

0 commit comments

Comments
 (0)