NvDsUserMeta¶
- class pyds.NvDsUserMeta¶
保存用户可以指定的用户元数据信息。
- 变量:
base_meta –
NvDsBaseMeta
, base_metauser_meta_data – 要附加的用户数据对象。有关用法,请参考 deepstream-user-metadata-test 示例。
用法示例,其中用户元数据类型为 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
- cast(*args, **kwargs)¶
重载函数。
cast(self: capsule) -> pyds.NvDsUserMeta
将给定对象/数据转换为
NvDsUserMeta
,调用 pyds.NvDsUserMeta.cast(data)cast(self: int) -> pyds.NvDsUserMeta
将给定对象/数据转换为
NvDsUserMeta
,调用 pyds.NvDsUserMeta.cast(data)