forked from NVIDIA-AI-IOT/deepstream_python_apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpydocumentation.h
More file actions
2154 lines (1711 loc) · 127 KB
/
pydocumentation.h
File metadata and controls
2154 lines (1711 loc) · 127 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// This file contains all Dims docstrings, since these are typically too long to keep in the binding code.
#pragma once
namespace pydsdoc
{
namespace trackerdoc
{
namespace NvDsPastFrameObjDoc //missing doxygen comments
{
constexpr const char* descr = R"pyds(
NvDsPastFrameObj
:ivar frameNum: *int*, frameNum
:ivar tBbox: :class:`NvOSD_RectParams`, tBbox
:ivar confidence: *float*, confidence
:ivar age: *int*, age
Example usage:
::
l_user=batch_meta.batch_user_meta_list #Retrieve glist of NvDsUserMeta objects from given NvDsBatchMeta object
while l_user is not None:
try:
# Note that l_user.data needs a cast to pyds.NvDsUserMeta
# The casting is done by pyds.NvDsUserMeta.cast()
# The casting also keeps ownership of the underlying memory
# in the C code, so the Python garbage collector will leave
# it alone
user_meta=pyds.NvDsUserMeta.cast(l_user.data)
except StopIteration:
break
if(user_meta and user_meta.base_meta.meta_type==pyds.NvDsMetaType.NVDS_TRACKER_PAST_FRAME_META): #Make sure metatype is correct
try:
# Note that user_meta.user_meta_data needs a cast to pyds.NvDsPastFrameObjBatch
# The casting is done by pyds.NvDsPastFrameObjBatch.cast()
# The casting also keeps ownership of the underlying memory
# in the C code, so the Python garbage collector will leave
# it alone
pPastFrameObjBatch = pyds.NvDsPastFrameObjBatch.cast(user_meta.user_meta_data) #See NvDsPastFrameObjBatch for details
except StopIteration:
break
for trackobj in pyds.NvDsPastFrameObjBatch.list(pPastFrameObjBatch): #Iterate through list of NvDsPastFrameObjStream objects
#Access NvDsPastFrameObjStream attributes
print("streamId=",trackobj.streamID)
print("surfaceStreamID=",trackobj.surfaceStreamID)
for pastframeobj in pyds.NvDsPastFrameObjStream.list(trackobj): #Iterate through list of NvDsFrameObjList objects
#Access NvDsPastFrameObjList attributes
print("numobj=",pastframeobj.numObj)
print("uniqueId=",pastframeobj.uniqueId)
print("classId=",pastframeobj.classId)
print("objLabel=",pastframeobj.objLabel)
for objlist in pyds.NvDsPastFrameObjList.list(pastframeobj): #Iterate through list of NvDsFrameObj objects
#Access NvDsPastFrameObj attributes
print('frameNum:', objlist.frameNum)
print('tBbox.left:', objlist.tBbox.left)
print('tBbox.width:', objlist.tBbox.width)
print('tBbox.top:', objlist.tBbox.top)
print('tBbox.right:', objlist.tBbox.height)
print('confidence:', objlist.confidence)
print('age:', objlist.age)
try:
l_user=l_user.next
except StopIteration:
break)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsPastFrameObj`, call pyds.NvDsPastFrameObj.cast(data))pyds";
}
namespace NvDsPastFrameObjListDoc
{
constexpr const char* descr = R"pyds(
One object in several past frames. See :class:`NvDsPastFrameObj` for example usage.
:ivar numObj: *int*, Number of frames this object appreared in the past.
:ivar uniqueId: *int*, Object tracking id.
:ivar classID: *int*, Object class id.
:ivar objLabel: An array of the string describing the object class.)pyds";
constexpr const char* list=R"pyds(Retrieve :class:`NvDsPastFrameObjList` object as list of :class:`NvDsPastFrameObj`. Contains past frame info of this object.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsPastFrameObjList`, call pyds.NvDsPastFrameObjList.cast(data))pyds";
}
namespace NvDsPastFrameObjStreamDoc
{
constexpr const char* descr = R"pyds(
List of objects in each stream. See :class:`NvDsPastFrameObj` for example usage.
:ivar streamID: *int*, Stream id the same as frame_meta->pad_index.
:ivar surfaceStreamID: *int*, Stream id used inside tracker plugin.
:ivar numAllocated: *int*, Maximum number of objects allocated.
:ivar numFilled: *int*, Number of objects in this frame.)pyds";
constexpr const char* list=R"pyds(Retrieve :class:`NvDsPastFrameObjStream` object as list of :class:`NvDsPastFrameObjList`. Contains objects inside this stream.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsPastFrameObjStream`, call pyds.NvDsPastFrameObjStream.cast(data))pyds";
}
namespace NvDsPastFrameObjBatchDoc
{
constexpr const char* descr = R"pyds(
Batch of lists of buffered objects. See :class:`NvDsPastFrameObj` for example usage.
:ivar numAllocated: *int*, Number of blocks allocated for the list.
:ivar numFilled: *int*, Number of filled blocks in the list.
)pyds";
constexpr const char* list=R"pyds(Retrieve :class:`NvDsPastFrameObjBatch` object as list of :class:`NvDsPastFrameObjStream`. Contains stream lists.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsPastFrameObjBatch`, call pyds.NvDsPastFrameObjBatch.cast(data))pyds";
}
}
namespace NvOSD
{
namespace NvOSD_Arrow_Head_Direction
{
constexpr const char* descr = R"pyds(*Enumerator*. Lists arrow head positions.)pyds";
constexpr const char* START_HEAD = R"pyds(Arrow head only at start = 0.)pyds";
constexpr const char* END_HEAD = R"pyds(Arrow head only at end = 1.)pyds";
constexpr const char* BOTH_HEAD = R"pyds(Arrow head at both sides = 2.)pyds";
}
namespace NvBbox_Coords
{
constexpr const char* descr = R"pyds(
Holds unclipped bounding box coordinates of the object.
:ivar left: *float*, Holds the box's left coordinate in pixels.
:ivar top: *float*, Holds the box's top coordinate in pixels.
:ivar width: *float*, Holds the box's width in pixels.
:ivar height: *float*, Holds the box's height in pixels.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvBbox_Coords`, call pyds.NvBbox_Coords.cast(data))pyds";
}
namespace NvOSD_FrameTextParams
{
constexpr const char* descr = R"pyds(
Holds information about the text in a frame.
:ivar buf_ptr: :class:`NvBufSurfaceParams`, Holds the buffer containing frame.
:ivar mode: :class:`NvOSD_Mode`, Holds OSD Mode to be used for processing.
:ivar num_strings: *int*, Holds number of strings.
:ivar text_params_list: list of :class:`NvOSD_TextParams`, Holds the strings' text parameters.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_FrameTextParams`, call pyds.NvOSD_FrameTextParams.cast(data))pyds";
}
namespace NvOSD_FrameRectParams
{
constexpr const char* descr = R"pyds(
Holds information about the rectangles in a frame.
:ivar buf_ptr: :class:`NvBufSurfaceParams`, Holds the buffer containing frame.
:ivar mode: :class:`NvOSD_Mode`, Holds OSD Mode to be used for processing.
:ivar num_rects: *int*, Holds number of rectangles.
:ivar rect_params_list: list of :class:`NvOSD_RectParams`, Holds the rectangles' parameters.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_FrameRectParams`, call pyds.NvOSD_FrameRectParams.cast(data))pyds";
}
namespace NvOSD_FrameLineParams
{
constexpr const char* descr = R"pyds(
Holds information about the lines in a frame.
:ivar buf_ptr: :class:`NvBufSurfaceParams`, Holds the buffer containing frame.
:ivar mode: :class:`NvOSD_Mode`, Holds OSD Mode to be used for processing.
:ivar num_lines: *int*, Holds number of lines.
:ivar line_params_list: list of :class:`NvOSD_LineParams`, Holds the lines' parameters.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_FrameLineParams`, call pyds.NvOSD_FrameLineParams.cast(data))pyds";
}
namespace NvOSD_FrameArrowParams
{
constexpr const char* descr = R"pyds(
Holds information about the arrows in a frame.
:ivar buf_ptr: :class:`NvBufSurfaceParams`, Holds the buffer containing frame.
:ivar mode: :class:`NvOSD_Mode`, Holds OSD Mode to be used for processing.
:ivar num_arrows: *int*, Holds number of arrows.
:ivar arrow_params_list: list of :class:`NvOSD_ArrowParams`, Holds the arrows' parameters.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_FrameArrowParams`, call pyds.NvOSD_FrameArrowParams.cast(data))pyds";
}
namespace NvOSD_FrameCircleParams
{
constexpr const char* descr = R"pyds(
Holds information about the circles in a frame.
:ivar buf_ptr: :class:`NvBufSurfaceParams`, Holds the buffer containing frame.
:ivar mode: :class:`NvOSD_Mode`, Holds OSD Mode to be used for processing.
:ivar num_circles: *int*, Holds number of circles.
:ivar circle_params_list: list of :class:`NvOSD_CircleParams`, Holds the circles' parameters.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_FrameCircleParams`, call pyds.NvOSD_FrameCircleParams.cast(data))pyds";
}
namespace ColorParamsDoc
{
constexpr const char* descr = R"pyds(
Holds the color parameters of the box or text to be overlayed. See :class:`NvOSD_TextParams` docs for example usage.
:ivar red: *float*, Holds red component of color. Value must be in the range 0-1.
:ivar green: *float*, Holds green component of color. Value must be in the range 0-1.
:ivar blue: *float*, Holds blue component of color. Value must be in the range 0-1.
:ivar alpha: *float*, Holds alpha component of color. Value must be in the range 0-1.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_ColorParams`, call pyds.NvOSD_ColorParams.cast(data))pyds";
constexpr const char* set=R"pyds(
Sets the color values.
:arg red: Value for red component (must be in range 0.-1.)
:arg green: Value for green component (must be in range 0.-1.)
:arg blue: Value for blue component (must be in range 0.-1.)
:arg alpha: Value for alpha component (must be in range 0.-1.))pyds";
}
namespace NvOSD_Mode
{
constexpr const char* descr = R"pyds(*Enumerator*. List modes used to overlay boxes and text.)pyds";
constexpr const char* MODE_CPU = R"pyds(Selects CPU for OSD processing. Works with RGBA data only.)pyds";
constexpr const char* MODE_GPU = R"pyds(Selects GPU for OSD processing. Yet to be implemented.)pyds";
constexpr const char* MODE_HW = R"pyds(Selects NV HW engine for rectangle draw and mask. This mode works with both YUV and RGB data. It does not consider alpha parameter. Not applicable for drawing text.)pyds";
}
namespace NvOSD_ArrowParams
{
constexpr const char* descr = R"pyds(
Holds arrow parameters to be overlaid.
:ivar x1: *int*, Holds start horizontal coordinate in pixels.
:ivar y1: *int*, Holds start vertical coordinate in pixels.
:ivar x2: *int*, Holds end horizontal coordinate in pixels.
:ivar y2: *int*, Holds end vertical coordinate in pixels.
:ivar arrow_width: *int*, Holds the arrow shaft width in pixels.
:ivar arrow_color: :class:`NvOSD_ColorParams`, Holds the color parameters of the arrow box.
:ivar arrow_head: :class:`NvOSD_Arrow_Head_Direction`, Holds the arrowhead position.
:ivar reserved: *int*, reserved field for future usage. For internal purpose only.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_ArrowParams`, call pyds.NvOSD_ArrowParams.cast(data))pyds";
}
namespace NvOSD_CircleParams
{
constexpr const char* descr = R"pyds(
Holds the circle parameters to be overlayed.
:ivar xc: *int*, Holds start horizontal coordinate in pixels.
:ivar yc: *int*, Holds start vertical coordinate in pixels.
:ivar radius: *int*, Holds radius of circle in pixels.
:ivar circle_color: :class:`NvOSD_ColorParams`, Holds color params of the circle.
:ivar has_bg_color: *int*, Holds boolean value indicating whethercircle has background color.
:ivar bg_color: :class:`NvOSD_ColorParams`, Holds the circle's background color.
:ivar reserved: *int*, Reserved field for future usage. For internal purpose only.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_CircleParams`, call pyds.NvOSD_CircleParams.cast(data))pyds";
}
namespace FontParamsDoc
{
constexpr const char* descr = R"pyds(
Holds the font parameters of the text to be overlayed. See :class:`NvOSD_TextParams` docs for example usage.
:ivar fontname: *str*, Holds the font name. The list of supported fonts can be obtained by running fc-list command
:ivar fontsize: *int*, Holds size of the font.
:ivar fontcolor: :class:`NvOSD_ColorParams`, Holds the font color.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_FontParams`, call pyds.NvOSD_FontParams.cast(data))pyds";
}
namespace TextParamsDoc
{
constexpr const char* descr = R"pyds(
Holds the parameters of the text to be overlaid.
:ivar display_text: *str*, Holds the text to be overlaid.
:ivar x_offset: *int*, Holds horizontal offset w.r.t top left pixel of the frame.
:ivar y_offset: *int*, Holds vertical offset w.r.t top left pixel of the frame.
:ivar font_params: :class:`NvOSD_FontParams`, Holds the font parameters of the text to be overlaid.
:ivar set_bg_clr: *int*, Boolean to indicate text has background color.
:ivar text_bg_clr: :class:`NvOSD_ColorParams`, Holds the text's background color, if specified.
Example usage:
::
display_meta=pyds.nvds_acquire_display_meta_from_pool(batch_meta) #Retrieve NvDsDisplayMeta object from given NvDsBatchMeta object. See NvDsMeta docs for more details.
display_meta.num_labels = 1
py_nvosd_text_params = display_meta.text_params[0] #Retrieve NvOSD_TextParams object from list in display meta.
# Setting display text to be shown on screen
# Note that the pyds module allocates a buffer for the string, and the
# memory will not be claimed by the garbage collector.
# Reading the display_text field here will return the C address of the
# allocated string. Use pyds.get_string() to get the string content.
py_nvosd_text_params.display_text = "Frame Number={} Number of Objects={} Vehicle_count={} Person_count={}".format(frame_number, num_rects, obj_counter[PGIE_CLASS_ID_VEHICLE], obj_counter[PGIE_CLASS_ID_PERSON])
# Now set the offsets where the string should appear
py_nvosd_text_params.x_offset = 10
py_nvosd_text_params.y_offset = 12
# Font , font-color and font-size
py_nvosd_text_params.font_params.font_name = "Serif" #Set attributes of our NvOSD_TextParams object's NvOSD_FontParams member
py_nvosd_text_params.font_params.font_size = 10
# set(red, green, blue, alpha); set to White
py_nvosd_text_params.font_params.font_color.set(1.0, 1.0, 1.0, 1.0) #See NvOSD_ColorParams for more details.
# Text background color
py_nvosd_text_params.set_bg_clr = 1 #Set boolean indicating that text has bg color to true.
# set(red, green, blue, alpha); set to Black
py_nvosd_text_params.text_bg_clr.set(0.0, 0.0, 0.0, 1.0)
# Using pyds.get_string() to get display_text as string
print(pyds.get_string(py_nvosd_text_params.display_text))
pyds.nvds_add_display_meta_to_frame(frame_meta, display_meta) #Add display meta to frame after setting text params attributes.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_TextParams`, call pyds.NvOSD_TextParams.cast(data))pyds";
}
//TODO, doxygen comments missing
namespace Color_infoDoc
{
constexpr const char* descr=R"pyds(
NvOSD_Color_info.
:ivar id: id
:ivar color: color)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_Color_info`, call pyds.NvOSD_Color_info.cast(data))pyds";
}
namespace RectParamsDoc
{
constexpr const char* descr = R"pyds(
Holds the box parameters of the box to be overlaid.
:ivar left: *float*, Holds left coordinate of the box in pixels.
:ivar top: *float*, Holds top coordinate of the box in pixels.
:ivar width: *float*, Holds width of the box in pixels.
:ivar height: *float*, Holds height of the box in pixels.
:ivar border_width: *int*, Holds border_width of the box in pixels.
:ivar border_color: :class:`NvOSD_ColorParams`, Holds color params of the border of the box.
:ivar has_bg_color: *int*, Holds boolean value indicating whether box has background color.
:ivar bg_color: :class:`NvOSD_ColorParams`, Holds background color of the box.
:ivar has_color_info: *int*, color_info
:ivar color_id: *int*, id of the color
:ivar reserved: *int*, Reserved field for future usage. For internal purpose only.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_RectParams`, call pyds.NvOSD_RectParams.cast(data))pyds";
}
namespace LineParamsDoc
{
constexpr const char* descr = R"pyds(
Holds the box parameters of the line to be overlaid.
:ivar x1: *int*, Holds left coordinate of the box in pixels.
:ivar y1: *int*, Holds top coordinate of the box in pixels.
:ivar x2: *int*, Holds width of the box in pixels.
:ivar y2: *int*, Holds height of the box in pixels.
:ivar line_width: *int*, Holds border_width of the box in pixels.
:ivar line_color: :class:`NvOSD_ColorParams`, Holds color params of the border of the box.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvOSD_LineParams`, call pyds.NvOSD_LineParams.cast(data))pyds";
}
}
namespace nvmeta
{
namespace MetaTypeDoc
{
constexpr const char* descr = R"pyds(
*Enumerator*. Specifies the type of meta data.
NVIDIA defined NvDsMetaType will be present in the range from NVDS_BATCH_META to NVDS_START_USER_META.
User can add its own metadata type NVDS_START_USER_META onwards.)pyds";
constexpr const char* NVDS_INVALID_META=R"pyds(NVDS_INVALID_META)pyds";
constexpr const char* NVDS_BATCH_META=R"pyds(metadata type to be set for formed batch)pyds";
constexpr const char* NVDS_FRAME_META=R"pyds(metadata type to be set for frame)pyds";
constexpr const char* NVDS_OBJ_META=R"pyds(metadata type to be set for detected object )pyds";
constexpr const char* NVDS_DISPLAY_META=R"pyds(metadata type to be set for display)pyds";
constexpr const char* NVDS_CLASSIFIER_META=R"pyds(metadata type to be set for object classifier)pyds";
constexpr const char* NVDS_LABEL_INFO_META=R"pyds(metadata type to be set for given label of classifier)pyds";
constexpr const char* NVDS_USER_META=R"pyds(used for internal purpose)pyds";
constexpr const char* NVDS_PAYLOAD_META=R"pyds(metadata type to be set for payload generated by msg converter)pyds";
constexpr const char* NVDS_EVENT_MSG_META=R"pyds(metadata type to be set for payload generated by msg broker)pyds";
constexpr const char* NVDS_OPTICAL_FLOW_META=R"pyds(metadata type to be set for optical flow)pyds";
constexpr const char* NVDS_LATENCY_MEASUREMENT_META=R"pyds(metadata type to be set for latency measurement)pyds";
constexpr const char* NVDSINFER_TENSOR_OUTPUT_META=R"pyds(metadata type of raw inference output attached by gst-nvinfer. Refer :class:`NvDsInferTensorMeta` for details.)pyds";
constexpr const char* NVDSINFER_SEGMENTATION_META=R"pyds(metadata type of segmentation model output attached by gst-nvinfer. Refer :class:`NvDsInferSegmentationMeta` for details.)pyds";
constexpr const char* NVDS_CROP_IMAGE_META=R"pyds(Specifies metadata type for JPEG-encoded object crops.See the deepstream-image-meta-test app for details.)pyds";
constexpr const char* NVDS_TRACKER_PAST_FRAME_META=R"pyds(metadata type to be set for tracking previous frames)pyds";
constexpr const char* NVDS_AUDIO_BATCH_META=R"pyds(Specifies metadata type for formed audio batch.)pyds";
constexpr const char* NVDS_AUDIO_FRAME_META=R"pyds(Specifies metadata type for audio frame.)pyds";
constexpr const char* NVDS_RESERVED_META=R"pyds(Reserved field)pyds";
constexpr const char* NVDS_GST_CUSTOM_META=R"pyds(metadata type to be set for metadata attached by nvidia gstreamer plugins before nvstreammux gstreamer plugin. It is set as user metadata inside :class:`NvDsFrameMeta`. NVIDIA specific gst meta are in the range from NVDS_GST_CUSTOM_META to NVDS_GST_CUSTOM_META + 4096)pyds";
constexpr const char* NVDS_START_USER_META=R"pyds(NVDS_START_USER_META)pyds";
constexpr const char* NVDS_FORCE32_META=R"pyds(NVDS_FORCE32_META)pyds";
}
namespace NvDsComp_BboxInfoDoc
{
constexpr const char* descr = R"pyds(
Holds unclipped positional bounding box coordinates of the object processed by the component.
:ivar org_bbox_coords: :class:`NvBbox_Coords`, org_bbox_coords)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsComp_BboxInfo`, call pyds.NvDsComp_BboxInfo.cast(data))pyds";
}
namespace GstNvDsMetaTypeDoc
{
constexpr const char* descr = R"pyds(
*Enumerator*. Specifies the type of meta data.
NVIDIA defined :class:`GstNvDsMetaType` values are in the range from NVDS_BATCH_GST_META to NVDS_START_USER_META.)pyds";
constexpr const char* NVDS_GST_INVALID_META=R"pyds(NVDS_GST_INVALID_META)pyds";
constexpr const char* NVDS_BATCH_GST_META=R"pyds(Specifies information of a formed batch.)pyds";
constexpr const char* NVDS_DECODER_GST_META=R"pyds(NVDS_DECODER_GST_META)pyds";
constexpr const char* NVDS_DEWARPER_GST_META=R"pyds(Specifies information of dewarped surfaces.)pyds";
constexpr const char* NVDS_RESERVED_GST_META=R"pyds(NVDS_RESERVED_GST_META)pyds";
constexpr const char* NVDS_GST_META_FORCE32=R"pyds(Specifies the first value that may be assigned to a user-defined type.)pyds";
}
namespace NvDsMetaDoc
{
constexpr const char* descr = R"pyds(
Holds DeepStream meta data.
:ivar meta: *GstMeta* object.
:ivar meta_data: Metadata object. Must be cast to another structure based on :py:attr:`meta_type`.
:ivar user_data: User-specific data
:ivar meta_type: Type of metadata, one of values of :class:`GstNvDsMetaType`)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsMeta`, call pyds.NvDsMeta.cast(data))pyds";
}
namespace MetaPoolDoc
{
constexpr const char* descr = R"pyds(
Holds information about given metadata pool.
:ivar meta_type: :class:`NvDsMetaType`, type of the pool. Used for internal purpose.
:ivar max_elements_in_pool: *int*, max elements in the pool. Used for internal purpose.
:ivar element_size: *int*, size of an element in the given pool. Used for internal purpose.
:ivar num_empty_elements: *int*, number of empty elements. Used for internal purpose.
:ivar num_full_elements: *int*, number of filled elements. These many elemnts are in use.
:ivar empty_list: :class:`NvDsMetaList`, List containing empty elements.
:ivar full_list: :class:`NvDsMetaList`, List containing full elements.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsMetaPool`, call pyds.NvDsMetaPool.cast(data))pyds";
}
namespace BaseMetaDoc
{
constexpr const char* descr = R"pyds(
Holds information about base metadata of given metadata type.
:ivar batch_meta: batch_meta
:ivar meta_type: Metadata type of the given element.
:ivar uContext: user context)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsBaseMeta`, call pyds.NvDsBaseMeta.cast(data))pyds";
}
namespace BatchMetaDoc
{
constexpr const char* descr = R"pyds(
Holds information a formed batched containing the frames from different sources.
NOTE: Both Video and Audio metadata uses the same :class:`NvDsBatchMeta` type.
NOTE: Audio batch metadata is formed within nvinferaudio plugin and will not be corresponding to any one buffer output from nvinferaudio.
The :class:`NvDsBatchMeta` for audio is attached to the last input buffer when the audio batch buffering reach configurable threshold (audio frame length)
and this is when inference output is available.
:ivar base_meta: :class:`NvDsBaseMeta`, base_meta
:ivar max_frames_in_batch: *int*, maximum number of frames those can be present the batch.
:ivar num_frames_in_batch: *int*, Number of frames present in the current batch.
:ivar frame_meta_pool: :class:`NvDsMetaPool`, pool of type :class:`NvDsFrameMeta`.
:ivar obj_meta_pool: :class:`NvDsMetaPool`, pool of type :class:`NvDsObjMeta`.
:ivar classifier_meta_pool: :class:`NvDsMetaPool`, pool of type :class:`NvDsClassifierMeta`.
:ivar display_meta_pool: :class:`NvDsMetaPool`, A pool of type :class:`NvDsDisplayMeta`.
:ivar user_meta_pool: :class:`NvDsMetaPool`, A pool of type :class:`NvDsUserMeta`.
:ivar label_info_meta_pool: :class:`NvDsMetaPool`, A pool of type :class:`NvDsLabelInfo`.
:ivar frame_meta_list: A list of items of type :class:`NvDsFrameMeta` in use in the current batch.
:ivar batch_user_meta_list: A list of items of type :class:`NvDsUserMeta` in use in the current batch.
:ivar meta_mutex: *GRecMutex*, lock to be taken before accessing metadata to avoid simultaneous update of same metadata by multiple components.
:ivar misc_batch_info: *list of int*, For additional user specific batch info.
:ivar reserved: *int*, Reserved for internal use.
Example usage:
::
# Retrieve batch metadata from the gst_buffer
# Note that pyds.gst_buffer_get_nvds_batch_meta() expects the
# C address of gst_buffer as input, which is obtained with hash(gst_buffer)
batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
l_frame = batch_meta.frame_meta_list #Get list containing NvDsFrameMeta objects from retrieved NvDsBatchMeta)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsBatchMeta`, call pyds.NvDsBatchMeta.cast(data))pyds";
}
namespace FrameMetaDoc
{
constexpr const char* descr = R"pyds(
Holds metadata for a frame in a batch.
:ivar base_meta: :class:`NvDsBaseMeta`, Base metadata for frame.
:ivar pad_index: *int*, Pad or port index of stream muxer component for the frame in the batch.
:ivar batch_id: *int*, Location of the frame in the batch. :class:`NvBufSurfaceParams` for the frame will be at index batch_id in the surfaceList array of :class:`NvBufSurface`.
:ivar frame_num: *int*, Current frame number of the source.
:ivar buf_pts: *int*, Holds the presentation timestamp (PTS) of the frame.
:ivar ntp_timestamp: *int*, Holds the ntp (network time protocol) timestamp.
:ivar source_id: *int*, Source_id of the frame in the batch e.g. camera_id. It need not be in sequential order.
:ivar num_surfaces_per_frame: *int*, Number of surfaces present in this frame. This is required in case multiple surfaces per frame.
:ivar source_frame_width: *int*, Holds the width of the frame at input to Gst-streammux.
:ivar source_frame_height: *int*, Holds the height of the frame at input to Gst-streammux.
:ivar surface_type: *int*, Surface type of sub frame. This is required in case multiple surfaces per frame.
:ivar surface_index: *int*, Surface index of sub frame. This is required in case multiple surfaces per frame.
:ivar num_obj_meta: *int*, Number of object meta elements attached to the current frame.
:ivar bInferDone: *int*, Boolean indicating whether inference is performed on given frame.
:ivar obj_meta_list: List of objects of type :class:`NvDsObjectMeta` in use for the given frame.
:ivar display_meta_list: List of objects of type :class:`NvDsDisplayMeta` in use for the given frame.
:ivar frame_user_meta_list: List of objects of type :class:`NvDsUserMeta` in use for the given frame.
:ivar misc_frame_info: *list of int*, For additional user specific batch info.
:ivar reserved: *int*, Reserved for internal use.
Example usage:
::
batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer)) #Retrieve batch metadata from gst_buffer
l_frame = batch_meta.frame_meta_list
while l_frame is not None:
try:
frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data) #Must cast data in frame_meta_list to NvDsFrameMeta object
except StopIteration:
break
frame_number=frame_meta.frame_num #Retrieve current frame number from NvDsFrameMeta object
num_rects = frame_meta.num_obj_meta #Retrieve number of objects in frame from NvDsFrameMeta object
l_obj=frame_meta.obj_meta_list #Retrieve list of NvDsObjectMeta objects in frame from NvDsFrameMeta object)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsFrameMeta`, call pyds.NvDsFrameMeta.cast(data))pyds";
}
namespace ObjectMetaDoc
{
constexpr const char* descr = R"pyds(
Holds information of object metadata in the frame.
:ivar base_meta: :class:`NvDsBaseMeta`, base_meta
:ivar parent: the parent :class:`NvDsObjectMeta` object. Set to None if parent is not present
:ivar unique_component_id: *int*, unique component id that attaches NvDsObjectMeta metadata
:ivar class_id: *int*, Index of the object class infered by the primary detector/classifier
:ivar object_id: *int*, Unique ID for tracking the object. @ref UNTRACKED_OBJECT_ID indicates the object has not been tracked
:ivar confidence: *float*, Holds a confidence value for the object, set by the inference component.
Confidence will be set to -0.1, if "Group Rectangles" mode of clustering is chosen since the algorithm does not preserve confidence values.
Also, for objects found by tracker and not inference component, confidence will be set to -0.1
:ivar detector_bbox_info: :class:`NvDsComp_BboxInfo`, Holds a structure containing bounding box parameters of the object when detected by detector
:ivar tracker_bbox_info: :class:`NvDsComp_BboxInfo`, Holds a structure containing bounding box coordinates of the object when processed by tracker
:ivar tracker_confidence: *float*, Holds a confidence value for the object set by nvdcf_tracker. tracker_confidence will be set to -0.1 for KLT and IOU tracker
:ivar rect_params: :class:`NvOSD_RectParams`, Structure containing the positional parameters of the object in the frame.
e.g. If the tracker component is after the detector component in the pipeline, then positional parameters are from tracker component.
Can also be used to overlay borders / semi-transparent boxes on top of objects. See :class:`NvOSD_RectParams`
:ivar mask_params: :class:`NvOSD_MaskParams`, Holds mask parameters for the object. This mask is overlaid on object See :class:`NvOSD_MaskParams`
:ivar text_params: :class:`NvOSD_TextParams`, Text describing the object can be overlayed using this structure. See :class:`NvOSD_TextParams`
:ivar obj_label: An array to store the string describing the class of the detected object
:ivar classifier_meta_list: list of objects of type :class:`NvDsClassifierMeta`
:ivar obj_user_meta_list: list of objects of type :class:`NvDsUserMeta`
:ivar misc_obj_info: *list of int*, For additional user specific batch info
:ivar reserved: *int*, Reserved for internal use.
Example usage:
::
#Initialize dict to keep count of objects of each type
obj_counter = {
PGIE_CLASS_ID_VEHICLE:0,
PGIE_CLASS_ID_PERSON:0,
PGIE_CLASS_ID_BICYCLE:0,
PGIE_CLASS_ID_ROADSIGN:0
}
l_obj=frame_meta.obj_meta_list #Retrieve list of NvDsObjectMeta objects in frame from an NvDsFrameMeta object. See NvDsFrameMeta documentation for more details.
while l_obj is not None:
try:
# Casting l_obj.data to pyds.NvDsObjectMeta
obj_meta=pyds.NvDsObjectMeta.cast(l_obj.data)
except StopIteration:
break
obj_counter[obj_meta.class_id] += 1 #Retrieve class_id from NvDsObjectMeta (i.e. PGIE_CLASS_ID_VEHICLE, PGIE_CLASS_ID_PERSON, etc.) to update count
obj_meta.rect_params.border_color.set(0.0, 0.0, 1.0, 0.0) #Set border color of NvDsObjectMeta object's rect_params
try:
l_obj=l_obj.next
except StopIteration:
break)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsObjectMeta`, call pyds.NvDsObjectMeta.cast(data))pyds";
}
namespace ClassifierMetaDoc
{
constexpr const char* descr = R"pyds(
Holds classifier metadata for an object.
:ivar base_meta: :class:`NvDsBaseMeta`, base_meta
:ivar num_labels: *int*, Number of outputs/labels of the classifier.
:ivar unique_component_id: *int*, Unique component id that attaches NvDsClassifierMeta metadata.
:ivar label_info_list: List of objects of type :class:`NvDsLabelInfo`.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsClassifierMeta`, call pyds.NvDsClassifierMeta.cast(data))pyds";
}
namespace LabelInfoDoc
{
constexpr const char* descr = R"pyds(
Holds information of label metadata in the classifier.
:ivar base_meta: :class:`NvDsBaseMeta`, base_meta
:ivar num_classes: *int*, Number of classes of the given label.
:ivar result_label: An array to store the string describing the label of the classified object.
:ivar pResult_label: *str*, An object to store the result label if it exceeds MAX_LABEL_SIZE bytes.
:ivar result_class_id: *int*, class_id of the best result.
:ivar label_id: *int*, Holds the label ID in case there are multiple label classifiers.
:ivar result_prob: *float*, Probability of best result.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsLabelInfo`, call pyds.NvDsLabelInfo.cast(data))pyds";
}
namespace DisplayMetaDoc
{
constexpr const char* descr = R"pyds(
Holds information of display metadata that user can specify in the frame.
:ivar base_meta: :class:`NvDsBaseMeta`, base_meta
:ivar num_rects: *int*, Number of rectangles present in display meta.
:ivar num_labels: *int*, Number of labels/strings present in display meta.
:ivar num_lines: *int*, Number of lines present in display meta.
:ivar rect_params: List of :class:`NvOSD_RectParams`, Holds a list of positional parameters for rectangles. Used to overlay borders or semi-transparent rectangles, as required by the application. See :class:`NvOSD_RectParams`.
:ivar text_params: List of :class:`NvOSD_TextParams`, Holds a list of text parameters for user-defined strings that can be overlayed using this structure. See :class:`NvOSD_TextParams`.
:ivar line_params: List of :class:`NvOSD_LineParams`, Holds a list of line parameters that the user can use to draw polygons in the frame, e.g. to show a RoI in the frame. See :class:`NvOSD_LineParams`.
:ivar num_arrows: *int*, Holds the number of arrows described.
:ivar num_circles: *int*, Holds the number of circles described.
:ivar arrow_params: List of :class:`NvOSD_ArrowParams`, Holds a list of arrow parameters that the user can use to draw arrows in the frame. See :class:`NvOSD_ArrowParams`:
:ivar circle_params: List of :class:`NvOSD_CircleParams`, Holds a list of circle parameters that the user can use to draw circle in the frame. See :class:`NvOSD_CircleParams`.
:ivar misc_osd_data: *np.array of int*, Holds an np.array of user-defined OSD metadata.
:ivar reserved: *list of int*, Reserved for internal use.
Example usage:
::
display_meta=pyds.nvds_acquire_display_meta_from_pool(batch_meta) #Retrieve NvDsDisplayMeta object from pool in given NvDsBatchMeta object
display_meta.num_labels = 1
py_nvosd_text_params = display_meta.text_params[0] #Retrieve NvOSD_TextParams object from list in display meta. See NvOSD docs for more details.
# Setting display text to be shown on screen
# Note that the pyds module allocates a buffer for the string, and the
# memory will not be claimed by the garbage collector.
# Reading the display_text field here will return the C address of the
# allocated string. Use pyds.get_string() to get the string content.
py_nvosd_text_params.display_text = "Frame Number={} Number of Objects={} Vehicle_count={} Person_count={}".format(frame_number, num_rects, obj_counter[PGIE_CLASS_ID_VEHICLE], obj_counter[PGIE_CLASS_ID_PERSON])
print(pyds.get_string(py_nvosd_text_params.display_text))
pyds.nvds_add_display_meta_to_frame(frame_meta, display_meta) #Use method to add display_meta to frame_meta.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsDisplayMeta`, call pyds.NvDsDisplayMeta.cast(data))pyds";
}
namespace UserMetaDoc
{
constexpr const char* descr = R"pyds(
Holds information of user metadata that user can specify.
:ivar base_meta: :class:`NvDsBaseMeta`, base_meta
:ivar user_meta_data: User data object to be attached. Refer to deepstream-user-metadata-test example for usage.
Example usage, where user metadata is of type NVDS_TRACKER_PAST_FRAME_META:
::
l_user=batch_meta.batch_user_meta_list #Retrieve glist containing NvDsUserMeta objects from given NvDsBatchMeta object
while l_user is not None:
try:
# Note that l_user.data needs a cast to pyds.NvDsUserMeta
# The casting is done by pyds.NvDsUserMeta.cast()
# The casting also keeps ownership of the underlying memory
# in the C code, so the Python garbage collector will leave
# it alone
user_meta=pyds.NvDsUserMeta.cast(l_user.data)
except StopIteration:
break
if(user_meta and user_meta.base_meta.meta_type==pyds.NvDsMetaType.NVDS_TRACKER_PAST_FRAME_META): #Check data type of user_meta
try:
# Note that user_meta.user_meta_data needs a cast to pyds.NvDsPastFrameObjBatch
# The casting is done by pyds.NvDsPastFrameObjBatch.cast()
# The casting also keeps ownership of the underlying memory
# in the C code, so the Python garbage collector will leave
# it alone
pPastFrameObjBatch = pyds.NvDsPastFrameObjBatch.cast(user_meta.user_meta_data)
except StopIteration:
break
for trackobj in pyds.NvDsPastFrameObjBatch.list(pPastFrameObjBatch):
... #Examine past frame information, see NvDsTrackerMeta docs for details.
try:
l_user=l_user.next
except StopIteration:
break)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsUserMeta`, call pyds.NvDsUserMeta.cast(data))pyds";
}
}
namespace metaschema
{
namespace EventTypeDoc
{
constexpr const char* descr = R"pyds(*Enumerator*. Event type flags.)pyds";
constexpr const char* NVDS_EVENT_ENTRY=R"pyds(NVDS_EVENT_ENTRY)pyds";
constexpr const char* NVDS_EVENT_EXIT=R"pyds(NVDS_EVENT_EXIT)pyds";
constexpr const char* NVDS_EVENT_MOVING=R"pyds(NVDS_EVENT_MOVING)pyds";
constexpr const char* NVDS_EVENT_STOPPED=R"pyds(NVDS_EVENT_STOPPED)pyds";
constexpr const char* NVDS_EVENT_EMPTY=R"pyds(NVDS_EVENT_EMPTY)pyds";
constexpr const char* NVDS_EVENT_PARKED=R"pyds(NVDS_EVENT_PARKED)pyds";
constexpr const char* NVDS_EVENT_RESET=R"pyds(NVDS_EVENT_RESET)pyds";
constexpr const char* NVDS_EVENT_RESERVED=R"pyds(Reserved for future use. Use value greater than this for custom events.)pyds";
constexpr const char* NVDS_EVENT_CUSTOM=R"pyds(Specifies a custom event.)pyds";
constexpr const char* NVDS_EVENT_FORCE32=R"pyds(NVDS_EVENT_FORCE32)pyds";
}
namespace ObjectTypeDoc
{
constexpr const char* descr = R"pyds(*Enumerator*. Object type flags.)pyds";
constexpr const char* NVDS_OBJECT_TYPE_VEHICLE=R"pyds(NVDS_OBJECT_TYPE_VEHICLE)pyds";
constexpr const char* NVDS_OBJECT_TYPE_PERSON=R"pyds(NVDS_OBJECT_TYPE_PERSON)pyds";
constexpr const char* NVDS_OBJECT_TYPE_FACE=R"pyds(NVDS_OBJECT_TYPE_FACE)pyds";
constexpr const char* NVDS_OBJECT_TYPE_BAG=R"pyds(NVDS_OBJECT_TYPE_BAG)pyds";
constexpr const char* NVDS_OBJECT_TYPE_BICYCLE=R"pyds(NVDS_OBJECT_TYPE_BICYCLE)pyds";
constexpr const char* NVDS_OBJECT_TYPE_ROADSIGN=R"pyds(NVDS_OBJECT_TYPE_ROADSIGN)pyds";
constexpr const char* NVDS_OBJECT_TYPE_RESERVED=R"pyds(Reserved for future use. Use value greater than this for custom objects.)pyds";
constexpr const char* NVDS_OBJECT_TYPE_CUSTOM=R"pyds(To support custom object.)pyds";
constexpr const char* NVDS_OBJECT_TYPE_VEHICLE_EXT=R"pyds(NVDS_OBJECT_TYPE_VEHICLE_EXT)pyds";
constexpr const char* NVDS_OBJECT_TYPE_PERSON_EXT=R"pyds(NVDS_OBJECT_TYPE_PERSON_EXT)pyds";
constexpr const char* NVDS_OBJECT_TYPE_FACE_EXT=R"pyds(NVDS_OBJECT_TYPE_FACE_EXT)pyds";
constexpr const char* NVDS_OBJECT_TYPE_UNKNOWN=R"pyds("object" key will be missing in the schema)pyds";
constexpr const char* NVDS_OBEJCT_TYPE_FORCE32=R"pyds(NVDS_OBEJCT_TYPE_FORCE32)pyds";
}
namespace PayloadTypeDoc
{
constexpr const char* descr = R"pyds(*Enumerator*. Payload type flags.)pyds";
constexpr const char* NVDS_PAYLOAD_DEEPSTREAM=R"pyds(NVDS_PAYLOAD_DEEPSTREAM)pyds";
constexpr const char* NVDS_PAYLOAD_DEEPSTREAM_MINIMAL=R"pyds(NVDS_PAYLOAD_DEEPSTREAM_MINIMAL)pyds";
constexpr const char* NVDS_PAYLOAD_RESERVED=R"pyds(Reserved for future use. Use value greater than this for custom payloads.)pyds";
constexpr const char* NVDS_PAYLOAD_CUSTOM=R"pyds(To support custom payload. User need to implement nvds_msg2p_* interface)pyds";
constexpr const char* NVDS_PAYLOAD_FORCE32=R"pyds(NVDS_PAYLOAD_FORCE32)pyds";
}
namespace RectDoc
{
constexpr const char* descr = R"pyds(
Holds a rectangle's position and size.
:ivar top: *float*, Holds the position of rectangle's top in pixels.
:ivar left: *float*, Holds the position of rectangle's left side in pixels.
:ivar width: *float*, Holds the rectangle's width in pixels.
:ivar height: *float*, Holds the rectangle's height in pixels.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsRect`, call pyds.NvDsRect.cast(data))pyds";
}
namespace GeoLocationDoc
{
constexpr const char* descr = R"pyds(
Holds Geo-location parameters.
:ivar lat: *float*, Holds the location's latitude.
:ivar lon: *float*, Holds the location's longitude.
:ivar alt: *float*, Holds the location's altitude.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsGeoLocation`, call pyds.NvDsGeoLocation.cast(data))pyds";
}
namespace CoordinateDoc
{
constexpr const char* descr = R"pyds(
Hold coordinate parameters.
:ivar x: *float*, Holds the coordinate's X position.
:ivar y: *float*, Holds the coordinate's Y position.
:ivar z: *float*, Holds the coordinate's Z position.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsCoordinate`, call pyds.NvDsCoordinate.cast(data))pyds";
}
namespace ObjectSignatureDoc
{
constexpr const char* descr = R"pyds(
Holds object signature.
:ivar signature: *list of float*, Holds signature values.
:ivar size: *int*, Holds the number of signature values in signature.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsObjectSignature`, call pyds.NvDsObjectSignature.cast(data))pyds";
}
namespace VehicleObjectDoc
{
constexpr const char* descr = R"pyds(
Holds vehicle object parameters.
:ivar type: *str*, Type of the vehicle.
:ivar make: *str*, Make of the vehicle.
:ivar model: *str*, Model of the vehicle.
:ivar color: *str*, Color of the vehicle.
:ivar region: *str*, Region of the vehicle.
:ivar license: *str*, License number of the vehicle.
Example usage:
::
data = pyds.alloc_nvds_vehicle_object() #Allocate NvDsVehicleObject
obj = pyds.NvDsVehicleObject.cast(data);
#Set attributes
obj.type ="sedan"
obj.color="blue"
obj.make ="Bugatti"
obj.model = "M"
obj.license ="XX1234"
obj.region ="CA")pyds";
constexpr const char* cast=R"pyds(casts to :class:`NvDsVehicleObject` object, call pyds.NvDsVehicleObject(data))pyds";
}
namespace PersonObjectDoc
{
constexpr const char* descr = R"pyds(
Holds a person object's parameters.
:ivar gender: *str*, Person's gender.
:ivar hair: *str*, Person's hair color.
:ivar cap: *str*, Type of cap the person is wearing, if any.
:ivar apparel: *str*, Description of the person's apparel.
:ivar age: *int*, Person's age.
Example usage:
::
data = pyds.alloc_nvds_person_object() #Allocate NvDsPersonObject
obj = pyds.NvDsPersonObject.cast(data)
#Set attributes
obj.age = 45
obj.cap = "none"
obj.hair = "black"
obj.gender = "male"
obj.apparel= "formal")pyds";
constexpr const char* cast=R"pyds(casts to :class:`NvDsPersonObject` object, call pyds.NvDsPersonObject(data))pyds";
}
namespace FaceObjectDoc
{
constexpr const char* descr = R"pyds(
Holds face parameters.
:ivar gender: *str*, Person's gender.
:ivar hair: *str*, Person's hair color.
:ivar cap: *str*, Type of cap the person is wearing, if any.
:ivar glasses: *str*, Type of glasses the person is wearing, if any.
:ivar facialhair: *str*, Person's facial hair color.
:ivar name: *str*, Person's name.
:ivar eyecolor: *str*, Person's eye color.
:ivar age: *int*, Person's age.)pyds";
constexpr const char* cast=R"pyds(casts to :class:`NvDsFaceObject` object, call pyds.NvDsFaceObject(data))pyds";
}
namespace NvDsVehicleObjectExtDoc
{
constexpr const char* descr = R"pyds(
Holds a vehicle object's parameters.
:ivar type: *str*, Type of the vehicle.
:ivar make: *str*, Make of the vehicle.
:ivar model: *str*, Model of the vehicle.
:ivar color: *str*, Color of the vehicle.
:ivar region: *str*, Region of the vehicle.
:ivar license: *str*, License number of the vehicle.
:ivar mask: *Glist* of polygons for vehicle mask.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsVehicleObjectExt`, call pyds.NvDsVehicleObjectExt.cast(data))pyds";
}
namespace NvDsPersonObjectExtDoc
{
constexpr const char* descr = R"pyds(
Holds a vehicle object's parameters.
:ivar gender: *str*, Person's gender.
:ivar hair: *str*, Person's hair color.
:ivar cap: *str*, Type of cap the person is wearing, if any.
:ivar apparel: *str*, Description of the person's apparel.
:ivar age: *int*, Person's age.
:ivar mask: *Glist* of polygons for person mask.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsPersonObjectExt`, call pyds.NvDsPersonObjectExt.cast(data))pyds";
}
namespace NvDsFaceObjectWithExtDoc
{
constexpr const char* descr = R"pyds(
Holds a vehicle object's parameters.
:ivar gender: *str*, Person's gender.
:ivar hair: *str*, Person's hair color.
:ivar cap: *str*, Type of cap the person is wearing, if any.
:ivar glasses: *str*, Type of glasses the person is wearing, if any.W
:ivar facialhair: *str*, Person's facial hair color.Ws
:ivar name: *str*, Person's name.
:ivar eyecolor: *str*, Person's eye color.
:ivar age: *int*, Person's age.
:ivar mask: *Glist* of polygons for face mask.)pyds";
constexpr const char* cast=R"pyds(cast given object/data to :class:`NvDsFaceObjectWithExt`, call pyds.NvDsFaceObjectWithExt.cast(data))pyds";
}
namespace EventmsgDoc
{
constexpr const char* descr = R"pyds(
Holds event message meta data. You can attach various types of objects (vehicle, person, face, etc.) to an event by setting a pointer to the object in :py:attr:`extMsg`.
Similarly, you can attach a custom object to an event by setting a pointer to the object in :py:attr:`extMsg`.
A custom object must be handled by the metadata parsing module accordingly.
:ivar type: :class:`NvDsEventType`, Type of event.
:ivar objType: :class:`NvDsObjectType`, Type of object.
:ivar bbox: :class:`NvDsRect`, Bounding box of object.
:ivar location: :class:`NvDsGeoLocation`, Geo-location of object.
:ivar coordinate: :class:`NvDsCoordinate`, Coordinate of object.
:ivar objSignature: :class:`NvDsObjectSignature`, Signature of object.
:ivar objClassId: *int*, Class id of object.
:ivar sensorId: *int*, ID of sensor that generated the event.
:ivar moduleId: *int*, ID of analytics module that generated the event.
:ivar placeId: *int*, ID of place related to the object.
:ivar componentId: *int*, ID of component that generated this event.
:ivar frameId: *int*, Video frame ID of this event.
:ivar confidence: *int*, Confidence level of the inference.
:ivar trackingId: *int*, Tracking ID of object.
:ivar ts: *str*, Time stamp of generated event.
:ivar objectId: *str*, ID of detected / inferred object.
:ivar sensorStr: *str*, Identity string of sensor.
:ivar otherAttrs: *str*, Other attributes associated with the object.
:ivar videoPath: *str*, Name of video file.
:ivar extMsg: Object to extend the event message meta data. This can be used for custom values that can't be accommodated in the existing fields
OR if object(vehicle, person, face etc.) Specific values must be attached.
:ivar extMsgSize: *int*, Size of the custom object at extMsg.
Example usage:
::
def generate_event_msg_meta(data, class_id):
meta =pyds.NvDsEventMsgMeta.cast(data)
meta.sensorId = 0
meta.placeId = 0
meta.moduleId = 0
meta.sensorStr = "sensor-0"
meta.ts = pyds.alloc_buffer(MAX_TIME_STAMP_LEN + 1)
pyds.generate_ts_rfc3339(meta.ts, MAX_TIME_STAMP_LEN) #Generate timestamp
# This demonstrates how to attach custom objects.
# Any custom object as per requirement can be generated and attached
# like NvDsVehicleObject / NvDsPersonObject. Then that object should
# be handled in payload generator library (nvmsgconv.cpp) accordingly.
if(class_id==PGIE_CLASS_ID_VEHICLE):
meta.type = pyds.NvDsEventType.NVDS_EVENT_MOVING
meta.objType = pyds.NvDsObjectType.NVDS_OBJECT_TYPE_VEHICLE
meta.objClassId = PGIE_CLASS_ID_VEHICLE
obj = pyds.alloc_nvds_vehicle_object()
obj = generate_vehicle_meta(obj) #See NvDsVehicleObject example code
meta.extMsg = obj
meta.extMsgSize = sys.getsizeof(pyds.NvDsVehicleObject);
if(class_id == PGIE_CLASS_ID_PERSON):