|
|
|
@ -59,7 +59,7 @@ headless: bool = False
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
import cv2
|
|
|
|
|
import numpy as np # TODO use numpy types if available
|
|
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
import tkinter
|
|
|
|
@ -405,7 +405,7 @@ def get_color(new_otps_count: int, otp_url: str) -> ColorBGR:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO use cv2 types if available
|
|
|
|
|
def cv2_draw_box(img: Any, raw_pts: Any, color: ColorBGR) -> Any:
|
|
|
|
|
def cv2_draw_box(img: list[tuple[Any, Any]], raw_pts: list[tuple[Any, Any]], color: ColorBGR) -> np.ndarray[Any, np.dtype[np.int32]]:
|
|
|
|
|
pts = np.array([raw_pts], np.int32)
|
|
|
|
|
pts = pts.reshape((-1, 1, 2))
|
|
|
|
|
cv2.polylines(img, [pts], True, color, BOX_THICKNESS)
|
|
|
|
@ -413,7 +413,7 @@ def cv2_draw_box(img: Any, raw_pts: Any, color: ColorBGR) -> Any:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO use cv2 types if available
|
|
|
|
|
def cv2_print_text(img: Any, text: str, line_number: int, position: TextPosition, color: ColorBGR, opposite_len: Optional[int] = None) -> None:
|
|
|
|
|
def cv2_print_text(img: cv2.UMat, text: str, line_number: int, position: TextPosition, color: ColorBGR, opposite_len: Optional[int] = None) -> None:
|
|
|
|
|
window_dim = cv2.getWindowImageRect(WINDOW_NAME)
|
|
|
|
|
out_text = text
|
|
|
|
|
if opposite_len:
|
|
|
|
|