Ejemplo n.º 1
0
def test_marker_type_max_id_disallowed(marker_type: MarkerType) -> None:
    camera = MarkerCamera(marker_type.max_id,
                          marker_size=100,
                          marker_type=marker_type)
    camera.marker_id = marker_type.max_id + 1  # There's an assertion in the constructor
    with pytest.raises(cv2.error):
        camera.get_visible_markers()
Ejemplo n.º 2
0
def test_minimum_marker_size(marker_type: MarkerType) -> None:
    camera = MarkerCamera(
        marker_type.max_id,
        marker_size=marker_type.min_marker_image_size,
        marker_type=marker_type,
    )

    assert camera.get_visible_markers() == [marker_type.max_id]

    with pytest.raises(ValueError) as e:
        MarkerCamera(
            marker_type.max_id,
            marker_size=marker_type.min_marker_image_size - 1,
            marker_type=marker_type,
        )
    assert "marker must be at least" in e.value.args[0]
Ejemplo n.º 3
0
def test_marker_type_max_id_allowed(marker_type: MarkerType) -> None:
    camera = MarkerCamera(marker_type.max_id,
                          marker_size=100,
                          marker_type=marker_type)
    assert camera.get_visible_markers() == [marker_type.max_id]