Deepstream Bbox,text颜色参数设置
查看官方文档:https://docs.nvidia.com/metropolis/deepstream/python-api/PYTHON_API/NvDsOSD/NvOSD_RectParams.html
这里面存储了识别图像bbox和text的参数
test3的样例的注释里也有类似的sample:
下面展示一些 代码片
。
//
"""display_meta=pyds.nvds_acquire_display_meta_from_pool(batch_meta)
display_meta.num_labels = 1
py_nvosd_text_params = display_meta.text_params[0]
py_nvosd_text_params.display_text = "Frame Number={} Number of Objects={} Vehicle_count={} Person_count={}".format(frame_number, num_rects, vehicle_count, person)
py_nvosd_text_params.x_offset = 10;
py_nvosd_text_params.y_offset = 12;
py_nvosd_text_params.font_params.font_name = "Serif"
py_nvosd_text_params.font_params.font_size = 10
py_nvosd_text_params.font_params.font_color.red = 1.0
py_nvosd_text_params.font_params.font_color.green = 1.0
py_nvosd_text_params.font_params.font_color.blue = 1.0
py_nvosd_text_params.font_params.font_color.alpha = 1.0
py_nvosd_text_params.set_bg_clr = 1
py_nvosd_text_params.text_bg_clr.red = 0.0
py_nvosd_text_params.text_bg_clr.green = 0.0
py_nvosd_text_params.text_bg_clr.blue = 0.0
py_nvosd_text_params.text_bg_clr.alpha = 1.0
#print("Frame Number=", frame_number, "Number of Objects=",num_rects,"Vehicle_count=",vehicle_count,"Person_count=",person)
pyds.nvds_add_display_meta_to_frame(frame_meta, display_meta)"""
接下来展示bbox颜色框的设置
if obj_meta.class_id==0:
obj_meta.rect_params.border_color.set(1.0,0.0,0.0,0.5)
elif obj_meta.class_id==1:
obj_meta.rect.params.border_color.set(0.0,1.0,0.0,0.5)
elif obj_meta.class_id==2:
obj_meta.rect.params.border_color.set(0.0,0.0,1.0,0.5)
#最后一项模糊度不可以为0,为0则不可见