mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-02 13:59:10 +08:00
Fixup
This commit is contained in:
2 files changed
+6
-5
No files matched your search
@@ -315,9 +315,10 @@ class Cameras:
|
|||||||
dim=-1,
|
dim=-1,
|
||||||
)
|
)
|
||||||
elif self.camera_type[0] == CameraType.EQUIRECTANGULAR.value:
|
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])
|
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)
|
# use spherical in local camera coordinates (+y up, x=0 and z<0 is theta=0)
|
||||||
directions_stack = torch.stack(
|
directions_stack = torch.stack(
|
||||||
[-torch.sin(theta) * torch.sin(phi), torch.cos(phi), -torch.cos(theta) * torch.sin(phi)],
|
[-torch.sin(theta) * torch.sin(phi), torch.cos(phi), -torch.cos(theta) * torch.sin(phi)],
|
||||||
|
|||||||
@@ -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
|
# For now just assume it's all the same camera
|
||||||
cam = cams[list(cams.keys())[0]]
|
cam = cams[list(cams.keys())[0]]
|
||||||
out = {
|
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"]),
|
"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"],
|
"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"],
|
"cy": float(cam["c_y"]) if "c_y" in cam else 0.5 * cam["height"],
|
||||||
@@ -714,8 +714,8 @@ class ProcessImages:
|
|||||||
summary_log = []
|
summary_log = []
|
||||||
|
|
||||||
# Copy images to output directory
|
# Copy images to output directory
|
||||||
# NOTE(kchen): is this OK with COLMAP?
|
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=False)
|
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")
|
summary_log.append(f"Starting with {num_frames} images")
|
||||||
|
|
||||||
# Downscale images
|
# Downscale images
|
||||||
|
|||||||
Reference in new issue
Block a user