Skip to content

Conversation

AshAnand34
Copy link

Description

This pull request introduces an opacity parameter to various annotators in the supervision/annotators/core.py file, enabling control over the transparency of overlay masks. It also refines the color handling by switching from as_bgr() to as_bgra() to support alpha channels. Additionally, input validation has been added to ensure the scene parameter is not None.

Enhancements to Annotators:

  • Opacity Parameter Added: Introduced an opacity parameter (default 0.5) to all annotators, allowing users to control the transparency of overlay masks. This parameter is validated to ensure values are between 0 and 1.

  • Overlay Blending: Updated the annotate methods to blend overlays with the original scene using cv2.addWeighted, incorporating the new opacity parameter for smooth transparency effects.

Improvements to Color Handling:

  • Alpha Channel Support: Replaced color.as_bgr() with color.as_bgra() across all annotators to support alpha channels, which is essential for blending transparency.

Input Validation:

  • Scene Parameter Check: Added validation to ensure the scene parameter is not None before proceeding with annotation. A ValueError is raised if this condition is not met.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Any specific deployment considerations

For example, documentation changes, usability, usage/costs, secrets, etc.

Docs

  • Docs updated? What were the changes:

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.

1 participant