Add TriangleAnnotator example to documentation

This commit is contained in:
SkalskiP 2023-12-06 13:59:05 +01:00
parent f73829e941
commit 26ad007b7c
2 changed files with 42 additions and 0 deletions

View File

@ -103,6 +103,27 @@
</div>
=== "Triangle"
```python
>>> import supervision as sv
>>> image = ...
>>> detections = sv.Detections(...)
>>> triangle_annotator = sv.TriangleAnnotator()
>>> annotated_frame = triangle_annotator.annotate(
... scene=image.copy(),
... detections=detections
... )
```
<div class="result" markdown>
![triangle-annotator-example](https://media.roboflow.com/supervision-annotator-examples/triangle-annotator-example.png){ align=center width="800" }
</div>
=== "Ellipse"
```python
@ -330,6 +351,10 @@
:::supervision.annotators.core.DotAnnotator
## TriangleAnnotator
:::supervision.annotators.core.TriangleAnnotator
## EllipseAnnotator
:::supervision.annotators.core.EllipseAnnotator

View File

@ -1311,6 +1311,23 @@ class TriangleAnnotator(BaseAnnotator):
Returns:
np.ndarray: The annotated image.
Example:
```python
>>> import supervision as sv
>>> image = ...
>>> detections = sv.Detections(...)
>>> triangle_annotator = sv.TriangleAnnotator()
>>> annotated_frame = triangle_annotator.annotate(
... scene=image.copy(),
... detections=detections
... )
```
![triangle-annotator-example](https://media.roboflow.com/
supervision-annotator-examples/triangle-annotator-example.png)
"""
xy = detections.get_anchors_coordinates(anchor=self.position)
for detection_idx in range(len(detections)):