16 lines
441 B
Python
16 lines
441 B
Python
from __future__ import annotations
|
|
|
|
import numpy as np
|
|
from loguru import logger
|
|
|
|
|
|
TARGET_WIDTH = 1280
|
|
TARGET_HEIGHT = 720
|
|
|
|
|
|
def validate_frame_size(image: np.ndarray, width: int = TARGET_WIDTH, height: int = TARGET_HEIGHT) -> None:
|
|
"""验证视频帧尺寸是否与目标尺寸一致,不一致时记录警告"""
|
|
h, w = image.shape[:2]
|
|
if w != width or h != height:
|
|
logger.warning("Unexpected frame size: {}x{}", w, h)
|