@@ -132,11 +132,10 @@ std::shared_ptr<Frame> ObjectDetection::GetFrame(std::shared_ptr<Frame> frame, i
132132 if (display_text) {
133133 // Draw text label above bounding box
134134 // Get the confidence and classId for the current detection
135- float conf = detections.confidences .at (i);
136135 int classId = detections.classIds .at (i);
137136
138137 // Get the label for the class name and its confidence
139- QString label = QString::number (conf, ' f ' , 2 ); // Format confidence to two decimal places
138+ QString label = QString::number (objectId);
140139 if (!classNames.empty ()) {
141140 label = QString::fromStdString (classNames[classId]) + " :" + label;
142141 }
@@ -297,6 +296,7 @@ std::string ObjectDetection::GetVisibleObjects(int64_t frame_number) const{
297296 Json::Value root;
298297 root[" visible_objects_index" ] = Json::Value (Json::arrayValue);
299298 root[" visible_objects_id" ] = Json::Value (Json::arrayValue);
299+ root[" visible_class_names" ] = Json::Value (Json::arrayValue);
300300
301301 // Check if track data exists for the requested frame
302302 if (detectionsData.find (frame_number) == detectionsData.end ()){
@@ -311,11 +311,21 @@ std::string ObjectDetection::GetVisibleObjects(int64_t frame_number) const{
311311 continue ;
312312 }
313313
314- // Just display selected classes
315- if ( display_classes.size () > 0 &&
316- std::find (display_classes.begin (), display_classes.end (), classNames[detections.classIds .at (i)]) == display_classes.end ()){
317- continue ;
318- }
314+ // Get class name of tracked object
315+ auto className = classNames[detections.classIds .at (i)];
316+
317+ // If display_classes is not empty, check if className is in it
318+ if (!display_classes.empty ()) {
319+ auto it = std::find (display_classes.begin (), display_classes.end (), className);
320+ if (it == display_classes.end ()) {
321+ // If not in display_classes, skip this detection
322+ continue ;
323+ }
324+ root[" visible_class_names" ].append (className);
325+ } else {
326+ // include all class names
327+ root[" visible_class_names" ].append (className);
328+ }
319329
320330 int objectId = detections.objectIds .at (i);
321331 // Search for the object in the trackedObjects map
0 commit comments