NvDsDisplayMeta¶
- class pyds.NvDsDisplayMeta¶
包含用户可以在帧中指定的显示元数据信息。
- 变量:
base_meta –
NvDsBaseMeta
, base_metanum_rects – int, 显示元数据中矩形的数量。
num_labels – int, 显示元数据中标签/字符串的数量。
num_lines – int, 显示元数据中线条的数量。
rect_params –
NvOSD_RectParams
列表,包含矩形的位置参数列表。用于覆盖边框或半透明矩形,根据应用程序的需要。请参阅NvOSD_RectParams
。text_params –
NvOSD_TextParams
列表,包含用户定义的字符串的文本参数列表,可以使用此结构进行覆盖。请参阅NvOSD_TextParams
。line_params –
NvOSD_LineParams
列表,包含线条参数列表,用户可以使用这些参数在帧中绘制多边形,例如在帧中显示 RoI。请参阅NvOSD_LineParams
。num_arrows – int, 包含描述的箭头的数量。
num_circles – int, 包含描述的圆的数量。
arrow_params –
NvOSD_ArrowParams
列表,包含箭头参数列表,用户可以使用这些参数在帧中绘制箭头。请参阅NvOSD_ArrowParams
circle_params –
NvOSD_CircleParams
列表,包含圆形参数列表,用户可以使用这些参数在帧中绘制圆形。请参阅NvOSD_CircleParams
。misc_osd_data – np.array of int, 包含用户定义的 OSD 元数据的 np.array。
reserved – list of int, 保留供内部使用。
用法示例
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.
- cast(*args, **kwargs)¶
重载函数。
cast(self: capsule) -> pyds.NvDsDisplayMeta
将给定的对象/数据转换为
NvDsDisplayMeta
,调用 pyds.NvDsDisplayMeta.cast(data)cast(self: int) -> pyds.NvDsDisplayMeta
将给定的对象/数据转换为
NvDsDisplayMeta
,调用 pyds.NvDsDisplayMeta.cast(data)