turandai / gaussian_surfels

Implementation of the SIGGRAPH 2024 conference paper "High-quality Surface Reconstruction using Gaussian Surfels".
536 stars 26 forks source link

projection #29

Closed li1u closed 5 months ago

li1u commented 5 months ago

Hello, I have successfully obtained a 3D model through your code, and the model is very beautiful, but when I project the model onto the image, it does not match. I read the camera parameters and did the same as in your code? But I'm not sure if I'm missing something. ` ###

with open('/home/veily/gaussian_surfels/data/FEET/CY/transforms_train.json', 'r') as f:
       data = json.load(f)
fl_x = data['frames'][10]['fl_x']
fl_y = data['frames'][10]['fl_y']
cx = data['frames'][10]['cx']
cy = data['frames'][10]['cy']
dist_coeffs = data['frames'][10]['dist']
transform_matrix = data['frames'][10]['transform_matrix']
matrix = np.linalg.inv(transform_matrix) # w2c

R = np.transpose(matrix[:3,:3])
T = matrix[:3, 3]
R[:,1] *= -1
R[:,2] *= -1
T[1] *=- 1
T[2] *=- 1
......
 camera_matrix = np.array([[fl_x, 0, cx],
                          [0, fl_y, cy],
                          [0, 0, 1]], dtype=np.float64)

dist_coeffs = np.array(dist_coeffs, dtype=np.float64)
......
transformed_vertices = np.matmul(vertices, R.T) + T
image_points, _ = cv2.projectPoints(transformed_vertices, np.zeros((3, 1)), np.zeros((3, 1)), camera_matrix, dist_coeffs)

`