コード例 #1
0
ファイル: test_rectification.py プロジェクト: mje-nz/mjecv
def test_undistort_static_radtan():
    image = imread(DATA_DIR / "static-cam0-98.png")
    expected = imread(DATA_DIR / "static-cam0-98-undistorted-radtan.png")
    intrinsics_file = DATA_DIR / "camchain-static-radtan.yaml"
    cam = CameraIntrinsics.from_kalibr_yaml(intrinsics_file, "cam0")
    actual = cam.get_undistorter(extent=ImageExtent.OnlyValid).undistort_image(image)
    assert np.allclose(actual, expected)
コード例 #2
0
ファイル: test_checkerboards.py プロジェクト: mje-nz/mjecv
def load_chess1():
    """Load OpenCV test data."""
    data_dir = Path(__file__).parent / "data"
    image = imread(data_dir / "chess1.png")
    corners = yaml.load(open(data_dir / "chess_corners1.dat"),
                        Loader=yaml.SafeLoader)["corners"]
    shape = (corners["cols"], corners["rows"])
    expected = np.array(corners["data"]).reshape((-1, 2))
    return image, shape, expected
コード例 #3
0
ファイル: test_io.py プロジェクト: mje-nz/mjecv
def test_imread_invalid(tmp_path):
    file = tmp_path.joinpath("temp.png")
    file.touch()
    with pytest.raises(IOError):
        imread(file)
コード例 #4
0
ファイル: test_io.py プロジェクト: mje-nz/mjecv
def test_imread():
    image = imread(Path(__file__).parent / "data/chess1.png")
    assert image.shape == (240, 320)
コード例 #5
0
ファイル: test_io.py プロジェクト: mje-nz/mjecv
def test_imread_missing():
    with pytest.raises(FileNotFoundError):
        imread("missing_file.png")