Closed jiangyijin closed 3 months ago
Hi @jiangyijin, excuse me for the delayed reply.
I am not familiar with the SPEED+ dataset, please have a look at their documentation. If you found a solution in the meanwhile, feel free to share it below and close this issue.
In the future, I kindly ask you to refrain from posting questions here that are not directly related to BlenderNeRF, thanks!
https://github.com/graphdeco-inria/gaussian-splatting/issues/719#issue-2198958106 Hello, I have been working on 3D reconstruction using 3DGS recently. 3DGS can also be used to reconstruct with nerf datasets. However, I have been facing continuous reconstruction failures when using a public dataset SPEED+. Therefore, I would like to consult with you about the correctness of my camera pose transformation. I have encountered issues with the transformed SPEED+ dataset when training with nerf as well.
import json import math import numpy as np
Read the camera intrinsic parameters file.
with open('camera.json', 'r') as f: camera_params = json.load(f)
Read the camera extrinsic parameters file.
with open(r'G:\speed+\shirtv1\roe2\roe2.json', 'r') as f: extrinsic_params = json.load(f)
Extracting Camera Intrinsic Matrix
camera_matrix = np.array(camera_params['cameraMatrix']) dist_coeffs = np.array(camera_params['distCoeffs'])
calculate camera_angle_x
Nu = camera_params["Nu"] fx = camera_params["fx"] camera_angle_x = 2 math.atan(Nu / (2 fx))
Create storage for storing Nerf format data.
frames = []
def quaternion_to_rotation_matrix(q): q = np.array(q) r = np.array([[1 - 2 (q[2] 2 + q[3] 2), 2 (q[1] q[2] - q[0] q[3]), 2 (q[1] q[3] + q[0] q[2])], [2 (q[1] q[2] + q[0] q[3]), 1 - 2 (q[1] 2 + q[3] 2), 2 (q[2] q[3] - q[0] q[1])], [2 (q[1] q[3] - q[0] q[2]), 2 (q[2] q[3] + q[0] q[1]), 1 - 2 * (q[1] 2 + q[2] 2)]]) return r
for param in extrinsic_params: filename = param['filename'] q_vbs2tango_true = param['q_vbs2tango_true'] r_Vo2To_vbs_true = param['r_Vo2To_vbs_true']
Prepare data in Nerf format
nerf_data = { 'camera_angle_x': float(camera_params['ppx']), "rotation": frame["rotation"], 'frames': frames }
Write the data to a file
with open(r'G:\speed+\shirtv1\roe2\lightbox\roe1_to_nerf.json', 'w') as f: json.dump(nerf_data, f, indent=4)