Show detection confidente along with the class label

I see that, by default, the nvosd plugin renders the detection box and the class label of the object. I would like to add to the class label text box the confidence of the detection.

Could you give me any hint ??


You can refer our open source code deepstream_test1_app.c. The osd_sink_pad_buffer_probe function can show how to draw text in the bbox.

I think you are referring to this piece of code:

NvOSD_TextParams *txt_params  = &display_meta->text_params[0];
display_meta->num_labels = 1;
txt_params->display_text = g_malloc0 (MAX_DISPLAY_LEN);
offset = snprintf(txt_params->display_text, MAX_DISPLAY_LEN, "Person = %d ", person_count);
offset = snprintf(txt_params->display_text + offset , MAX_DISPLAY_LEN, "Vehicle = %d ", vehicle_count);

/* Now set the offsets where the string should appear */
txt_params->x_offset = 10;
txt_params->y_offset = 12;

This is not exactly what I want. As you can see in the following image, every detection has its label in top left corner of its bbox.

I want to add to this specific label its detection confidence. Is there any simple way to edit this text box or do I have to draw a new text box next to these ones?


No, not change the code you attached. I mean you can get the obj_meta from obj_meta = (NvDsObjectMeta *) (l_obj->data);. You can change the obj_meta->text_params to add anything you want then.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.