MCPcopy Create free account
hub / github.com/colmap/colmap / create_virtual_camera

Function create_virtual_camera

python/examples/panorama_sfm.py:89–109  ·  view source on GitHub ↗

Create a virtual perspective camera.

(
    *,
    pano_width: int,
    pano_height: int,
    hfov_deg: float,
    vfov_deg: float,
)

Source from the content-addressed store, hash-verified

87
88
89def create_virtual_camera(
90 *,
91 pano_width: int,
92 pano_height: int,
93 hfov_deg: float,
94 vfov_deg: float,
95) -> pycolmap.Camera:
96 """Create a virtual perspective camera."""
97 image_width = int(pano_width * hfov_deg / 360)
98 image_height = int(pano_height * vfov_deg / 180)
99 focal = image_width / (2 * np.tan(np.deg2rad(hfov_deg) / 2))
100 camera = pycolmap.Camera.create_from_model_id(
101 camera_id=0,
102 model=pycolmap.CameraModelId.SIMPLE_PINHOLE,
103 focal_length=focal,
104 width=image_width,
105 height=image_height,
106 )
107 # Not set by create_from_model_id.
108 camera.has_prior_focal_length = True
109 return camera
110
111
112def get_virtual_camera_rays(

Callers 1

processMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected