ready for tests

This commit is contained in:
SkalskiP 2025-04-23 15:41:42 +02:00
parent 185322fcd1
commit f866fe046f
2 changed files with 20 additions and 9 deletions

View File

@ -8,6 +8,10 @@ from supervision.draw.color import Color, ColorPalette
from supervision.geometry.core import Position
PENDING_TRACK_COLOR = Color.GREY
PENDING_TRACK_ID = -1
class ColorLookup(Enum):
"""
Enumeration class to define strategies for mapping colors to annotations.
@ -136,6 +140,8 @@ def resolve_color(
detection_idx=detection_idx,
color_lookup=color_lookup,
)
if color_lookup == ColorLookup.TRACK and idx == PENDING_TRACK_ID:
return PENDING_TRACK_COLOR
return get_color_by_index(color=color, idx=idx)

View File

@ -83,15 +83,16 @@ class Color:
# Color(r=255, g=255, b=255)
```
| Constant | Hex Code | RGB |
|------------|------------|------------------|
| `WHITE` | `#FFFFFF` | `(255, 255, 255)`|
| `BLACK` | `#000000` | `(0, 0, 0)` |
| `RED` | `#FF0000` | `(255, 0, 0)` |
| `GREEN` | `#00FF00` | `(0, 255, 0)` |
| `BLUE` | `#0000FF` | `(0, 0, 255)` |
| `YELLOW` | `#FFFF00` | `(255, 255, 0)` |
| `ROBOFLOW` | `#A351FB` | `(163, 81, 251)` |
| Constant | Hex Code | RGB |
|------------|------------|-------------------|
| `WHITE` | `#FFFFFF` | `(255, 255, 255)` |
| `BLACK` | `#000000` | `(0, 0, 0)` |
| `GREY` | `#808080` | `(128, 128, 128)` |
| `RED` | `#FF0000` | `(255, 0, 0)` |
| `GREEN` | `#00FF00` | `(0, 255, 0)` |
| `BLUE` | `#0000FF` | `(0, 0, 255)` |
| `YELLOW` | `#FFFF00` | `(255, 255, 0)` |
| `ROBOFLOW` | `#A351FB` | `(163, 81, 251)` |
"""
r: int
@ -235,6 +236,10 @@ class Color:
def BLACK(cls) -> Color:
return Color.from_hex("#000000")
@classproperty
def GREY(cls) -> Color:
return Color.from_hex("#808080")
@classproperty
def RED(cls) -> Color:
return Color.from_hex("#FF0000")