def test_detect_at_minimum_size(marker_type: MarkerType) -> None: marker_camera = MarkerCamera( 0, marker_size=marker_type.min_marker_image_size, marker_type=marker_type, border_size=MarkerCamera.MIN_BORDER_SIZE, ) frame = marker_camera.capture_frame() assert frame.shape == marker_camera.get_resolution() marker = next(marker_camera.process_frame(frame=frame)) assert marker.id == 0
def test_process_frame_eager(benchmark: Callable, marker_camera: MarkerCamera) -> None: frame = marker_camera.capture_frame() benchmark(lambda: list(marker_camera.process_frame_eager(frame=frame)))
def test_get_visible_markers(benchmark: Callable, marker_camera: MarkerCamera) -> None: frame = marker_camera.capture_frame() benchmark(marker_camera.get_visible_markers, frame=frame)
def test_captures_frame_at_correct_resolution(resolution): marker_camera = MarkerCamera(25, marker_dict=MarkerDict.DICT_6X6_50, marker_size=resolution) frame = marker_camera.capture_frame() assert frame.shape == marker_camera.get_resolution()
def test_captures_frame_at_correct_resolution( marker_size: int, marker_type: MarkerType ) -> None: marker_camera = MarkerCamera(25, marker_size=marker_size, marker_type=marker_type) frame = marker_camera.capture_frame() assert frame.shape == marker_camera.get_resolution()