Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions dlclivegui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from dlclivegui.utils.writegear_options import WriteGearOptions

Rotation = Literal[0, 90, 180, 270]
BGR = tuple[int, int, int] # color format
TileLayout = Literal["auto", "2x2", "1x4", "4x1"]
Precision = Literal["FP32", "FP16"]
ModelType = Literal["pytorch", "tensorflow"]
Expand Down Expand Up @@ -500,6 +501,25 @@ def _bbox_logic(self):
return self


class SkeletonColorMode(str, Enum):
SOLID = "solid"
GRADIENT_KEYPOINTS = "gradient_keypoints" # use endpoint keypoint colors


class SkeletonStyle(BaseModel):
visible: bool = False
color_mode: SkeletonColorMode = SkeletonColorMode.SOLID
color_bgr: BGR = (0, 255, 255) # default if SOLID
thickness: int = Field(defalt=2, ge=1, le=20) # base thickness in pixels
gradient_steps: int = Field(default=16, ge=2, le=128) # segments per edge when gradient
scale_with_zoom: bool = True # scale thickness with (sx, sy)

def effective_thickness(self, sx: float, sy: float) -> int:
if not self.scale_with_zoom:
return max(1, int(self.thickness))
return max(1, int(round(self.thickness * min(sx, sy))))


class VisualizationSettings(BaseModel):
p_cutoff: float = Field(default=0.6, ge=0.0, le=1.0)
colormap: str = "hot"
Expand Down
19 changes: 19 additions & 0 deletions dlclivegui/display/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from .display import (
BBoxColors,
compute_tile_info,
compute_tiling_geometry,
create_tiled_frame,
draw_bbox,
draw_keypoints,
draw_pose,
)

__all__ = [
"BBoxColors",
"compute_tile_info",
"compute_tiling_geometry",
"create_tiled_frame",
"draw_bbox",
"draw_keypoints",
"draw_pose",
]
File renamed without changes.
Loading
Loading