File size: 688 Bytes
fa98faf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from typing import Tuple

import cv2
import numpy as np
import supervision as sv


def draw_circle(
    scene: np.ndarray, center: sv.Point, color: sv.Color, radius: int = 2
) -> np.ndarray:
    cv2.circle(
        scene,
        center=center.as_xy_int_tuple(),
        radius=radius,
        color=color.as_bgr(),
        thickness=-1,
    )
    return scene


def calculate_dynamic_circle_radius(resolution_wh: Tuple[int, int]) -> int:
    min_dimension = min(resolution_wh)
    if min_dimension < 480:
        return 4
    if min_dimension < 720:
        return 8
    if min_dimension < 1080:
        return 8
    if min_dimension < 2160:
        return 16
    else:
        return 16