-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
I change the Replica dataset to NeRFSythetic dataformat so that it can be input to 3DGS, the point_cloud i get is through Co-SLAM. When i run 3dgs i found the rendering results is right, but the multi-view results in supersplat is wrong like this:
whats the problem, and the input ply is like that:

and the python script i use to change Replica to NeRFSythetic is as follow:
import os
import shutil
import numpy as np
import json
from glob import glob
from tqdm import tqdm
sequences = ["office2"]
replica_root_base = "/data/Replica" # <--
output_base = "Replica_blender"
fx = 600.0
w = 1200
camera_angle_x = 2 * np.arctan(w / (2 * fx))
print(f"📐 计算得到 camera_angle_x = {camera_angle_x:.6f} 弧度")
for seq_name in sequences:
print(f"\n🔧 正在处理序列: {seq_name}")
replica_root = os.path.join(replica_root_base, seq_name, "results")
traj_path = os.path.join(replica_root_base, seq_name, "traj.txt")
train_dir = os.path.join(output_base, seq_name, "train")
os.makedirs(train_dir, exist_ok=True)
frame_paths = sorted(glob(os.path.join(replica_root, "frame*.jpg")))
if not os.path.exists(traj_path):
print(f"⚠️ 跳过 {seq_name}: 未找到 traj.txt")
continue
poses = []
with open(traj_path, 'r') as f:
for line in f:
vals = list(map(float, line.strip().split()))
if len(vals) != 16:
continue
mat = np.array(vals).reshape(4, 4)
mat[:3, 1] *= -1
mat[:3, 2] *= -1
poses.append(mat)
if len(poses) != len(frame_paths):
print(f"❌ 位姿数({len(poses)})与图像数({len(frame_paths)})不一致,跳过 {seq_name}")
continue
frames_json = []
for i, (img_path, pose) in enumerate(tqdm(zip(frame_paths, poses), total=len(poses))):
new_name = f"r_{i}.jpg"
shutil.copy(img_path, os.path.join(train_dir, new_name))
frames_json.append({
"file_path": f"./train/{new_name[:-4]}",
"rotation": 0.0,
"transform_matrix": pose.tolist()
})
transforms = {
"camera_angle_x": camera_angle_x,
"frames": frames_json
}
with open(os.path.join(output_base, seq_name, "transforms_train.json"), 'w') as f:
json.dump(transforms, f, indent=4)
print(f"✅ {seq_name} 转换完成,帧数: {len(poses)},保存至 {os.path.join(output_base, seq_name)}")