Skip to content

Commit 1b8ff61

Browse files
committed
πŸ“˜ docs updates for Position and get_anchor_coordinates
1 parent 5bc83bf commit 1b8ff61

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

β€Ždocs/geometry/core.mdβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Position
2+
3+
:::supervision.geometry.core.Position

β€Žsupervision/detection/core.pyβ€Ž

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -644,15 +644,23 @@ def __all_not_none(item_list: List[Any]):
644644

645645
def get_anchor_coordinates(self, anchor: Position) -> np.ndarray:
646646
"""
647-
Returns the bounding box coordinates for a specific anchor.
647+
Calculates and returns the coordinates of a specific anchor point
648+
within the bounding boxes defined by the `xyxy` attribute. The anchor
649+
point can be any of the predefined positions in the `Position` enum,
650+
such as `CENTER`, `CENTER_LEFT`, `BOTTOM_RIGHT`, etc.
648651
649652
Args:
650-
anchor (Position): Position of bounding box anchor
651-
for which to return the coordinates.
653+
anchor (Position): An enum specifying the position of the anchor point
654+
within the bounding box. Supported positions are defined in the
655+
`Position` enum.
652656
653657
Returns:
654-
np.ndarray: An array of shape `(n, 2)` containing the bounding
655-
box anchor coordinates in format `[x, y]`.
658+
np.ndarray: An array of shape `(n, 2)`, where `n` is the number of bounding
659+
boxes. Each row contains the `[x, y]` coordinates of the specified
660+
anchor point for the corresponding bounding box.
661+
662+
Raises:
663+
ValueError: If the provided `anchor` is not supported.
656664
"""
657665
if anchor == Position.CENTER:
658666
return np.array(

β€Žsupervision/geometry/core.pyβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77

88
class Position(Enum):
9+
"""
10+
Enum representing the position of an anchor point.
11+
"""
912
CENTER = "CENTER"
1013
CENTER_LEFT = "CENTER_LEFT"
1114
CENTER_RIGHT = "CENTER_RIGHT"

0 commit comments

Comments
Β (0)