Skip to content

[GST gvawatermark] Add inclusive/exclusive label filtering#619

Merged
walidbarakat merged 2 commits intomainfrom
support_filtring_object_detection
Feb 18, 2026
Merged

[GST gvawatermark] Add inclusive/exclusive label filtering#619
walidbarakat merged 2 commits intomainfrom
support_filtring_object_detection

Conversation

@walidbarakat
Copy link
Copy Markdown
Contributor

Description

Implement object label filtering functionality that allows users to control which detected objects are highlighted with watermark based on their classification labels.

  • Add include-labels and exclude-labels parameters to displ-cfg
  • Support colon-delimited label specification (e.g., "person:car:bicycle")
  • Precedence logic where inclusion filters above exclusion filters
  • Add parseFilterConfig utility function for label parsing
  • Update documentation with filtering parameter usage examples

Checklist:

  • I agree to use the MIT license for my code changes.
  • I have not introduced any 3rd party components incompatible with MIT.
  • I have not included any company confidential information, trade secret, password or security token.
  • I have performed a self-review of my code.

displ-cfg=font-scale=1.5,thickness=3,color-idx=2,font-type=complex,draw-txt-bg=true

# Show only specific object types
displ-cfg=include-labels=person:car:truck
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opt for changing the params names
include-labels -> show-labels
exclude-labels -> hide-labels

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

prims.reserve(video_frame_rois.size());
// Prepare primitives for all ROIs
for (auto &roi : video_frame_rois) {
if (is_ROI_filtered_out(roi.label()))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to preparePrimsForRoi method to avoid getting flickering displ-avgfps data when enabled

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

- All other detected objects will be hidden
- Useful for focusing on specific object types

e.g `displCfg=include-labels=car`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not 'displCfg' but ' displ-cfg'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@walidbarakat walidbarakat force-pushed the support_filtring_object_detection branch from dded12f to 6293e1e Compare February 17, 2026 17:03
}
cfg.erase(iter);
}
if (iter = cfg.find("show-labels"); iter != cfg.end()) {
Copy link
Copy Markdown
Contributor

@tbujewsk tbujewsk Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will not work with original show-labels param.
So, extend original show-label ln1180 about parsing filter config.
And move hide-labels part under if (_displCfg.show_labels) statement

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will work because find() is looking for first occurrence only, and then erase makes sure the found string isn't to be found again.
i think better to be more specific and instead of show[hide]-labels we can use show[hide]-roi
we don't need to add extra check or logical grouping between labels and ROI highlighting as one can configured without the other

"script_simplex, script_complex), default triplex\n" \
"\t\t\tdraw-txt-bg=<bool> enable or disable displaying text labels background, by enabling it the text color " \
"is set to white, default false\n" \
"\t\t\tinclude-labels=<string> colon-separated list of labels to include (only these objects will be shown), " \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix param names and ln87

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, regex mistake

Implement object label filtering functionality that allows users
to control which detected objects are highlighted with watermark
based on their classification labels.

- Add include-labels and exclude-labels parameters to displ-cfg
- Support colon-delimited label specification (e.g., "person:car:bicycle")
- Precedence logic where inclusion filters above exclusion filters
- Add parseFilterConfig utility function for label parsing
- Update documentation with filtering parameter usage examples

Signed-off-by: Walid <walid.aly@intel.com>
update licence header for utils implementation files.

Signed-off-by: Walid <walid.aly@intel.com>
@walidbarakat walidbarakat force-pushed the support_filtring_object_detection branch from 6293e1e to 1d40e7b Compare February 18, 2026 11:09
@walidbarakat walidbarakat merged commit 391b661 into main Feb 18, 2026
34 of 36 checks passed
@walidbarakat walidbarakat deleted the support_filtring_object_detection branch February 18, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants