4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 02:24:38 +08:00
This commit is contained in:
Kevin Chen 2022-11-09 06:45:30 +00:00
parent 110d085d1a
commit 20aaf40db0
No known key found for this signature in database
GPG Key ID: DC650012176D84EA
2 changed files with 6 additions and 5 deletions

View File

@ -315,9 +315,10 @@ class Cameras:
dim=-1,
)
elif self.camera_type[0] == CameraType.EQUIRECTANGULAR.value:
# u and v go from -1/2 to 1/2
# u goes from -1 to 1
# v goes from -1/2 to 1/2 (height is half of width)
theta = -torch.pi * coord_stack[..., 0]
phi = torch.pi * (0.5 - coord_stack[..., 1])
theta = -2 * torch.pi * coord_stack[..., 0]
# use spherical in local camera coordinates (+y up, x=0 and z<0 is theta=0)
directions_stack = torch.stack(
[-torch.sin(theta) * torch.sin(phi), torch.cos(phi), -torch.cos(theta) * torch.sin(phi)],

View File

@ -605,7 +605,7 @@ def opensfm_to_json(reconstruction_path: Path, output_dir: Path, camera_model: C
# For now just assume it's all the same camera
cam = cams[list(cams.keys())[0]]
out = {
"fl_x": float(cam["focal_x"]) if "focal_x" in cam else float(cam["width"]),
"fl_x": float(cam["focal_x"]) if "focal_x" in cam else float(cam["height"]),
"fl_y": float(cam["focal_y"]) if "focal_y" in cam else float(cam["height"]),
"cx": float(cam["c_x"]) if "c_x" in cam else 0.5 * cam["width"],
"cy": float(cam["c_y"]) if "c_y" in cam else 0.5 * cam["height"],
@ -714,8 +714,8 @@ class ProcessImages:
summary_log = []
# Copy images to output directory
# NOTE(kchen): is this OK with COLMAP?
num_frames = copy_images(self.data, image_dir=image_dir, verbose=self.verbose, rename=False)
rename_images = self.sfm_method != "OpenSfM" # OpenSfM does not rename images
num_frames = copy_images(self.data, image_dir=image_dir, verbose=self.verbose, rename=rename_images)
summary_log.append(f"Starting with {num_frames} images")
# Downscale images