4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 02:24:38 +08:00
nerfstudio/tests/structures/test_cameras.py
Ethan Weber e38040ee4d
Image dataset implemented and ray generation working. (#23)
* working data loader code

* adding gitignore

* fixing linting errors

* set black line length in settings file

* update

* fixed filepath

* black format

* tqdm
2022-04-17 09:26:44 -07:00

17 lines
516 B
Python

"""
Test the camera classes.
"""
import torch
from mattport.structures.cameras import PinholeCamera
from mattport.structures.rays import CameraRayBundle
def test_pinhole_camera():
"""Test that the pinhole camera model works."""
pinhole_camera = PinholeCamera(cx=400.0, cy=400.0, fx=10.0, fy=10.0)
camera_ray_bundle = pinhole_camera.generate_camera_rays()
assert isinstance(camera_ray_bundle, CameraRayBundle)
assert torch.allclose(camera_ray_bundle.origins[0], torch.tensor([0.0, 0.0, 0.0]))