Added a visual and code example for PolygonAnnotator in supervision/annotators/core.py and docs/annotators.md.

This commit is contained in:
SkalskiP
2023-11-15 17:49:17 +01:00
parent c1beb0f5fd
commit 2ed4e16ab5
2 changed files with 28 additions and 0 deletions
+21
View File
@@ -166,6 +166,27 @@
</div>
=== "Polygon"
```python
>>> import supervision as sv
>>> image = ...
>>> detections = sv.Detections(...)
>>> polygon_annotator = sv.PolygonAnnotator()
>>> annotated_frame = polygon_annotator.annotate(
... scene=image.copy(),
... detections=detections
... )
```
<div class="result" markdown>
![polygon-annotator-example](https://media.roboflow.com/supervision-annotator-examples/polygon-annotator-example-purple.png){ align=center width="800" }
</div>
=== "Label"
```python
+7
View File
@@ -233,6 +233,9 @@ class PolygonAnnotator(BaseAnnotator):
... detections=detections
... )
```
![polygon-annotator-example](https://media.roboflow.com/
supervision-annotator-examples/polygon-annotator-example-purple.png)
"""
if detections.mask is None:
return scene
@@ -343,6 +346,10 @@ class BoxMaskAnnotator(BaseAnnotator):
class HaloAnnotator(BaseAnnotator):
"""
A class for drawing Halos on an image using provided detections.
!!! warning
This annotator utilizes the `sv.Detections.mask`.
"""
def __init__(