Open SunJ1025 opened 6 months ago
you can solve this problem by change the way calculating the p2D as follow:
def project_to_image(p3D, R, t, camera, eps: float = 1e-4, pad: int = 1):
p3D = (p3D @ R.T) + t
visible = p3D[:, -1] >= eps # keep points in front of the camera
K = np.array([[camera.params[0], 0, camera.params[2]],
[0, camera.params[1], camera.params[3]],
[0, 0, 1]])
p2D_homogeneous = p3D[:, :-1] / p3D[:, -1:].clip(min=eps)
p2D_homogeneous = np.concatenate([p2D_homogeneous, np.ones((p2D_homogeneous.shape[0], 1))], axis=1)
p2D = p2D_homogeneous @ K.T
size = np.array([camera.width - pad - 1, camera.height - pad - 1])
valid = np.all((p2D[:, :2] >= pad) & (p2D[:, :2] <= size), -1)
valid &= visible
return p2D[valid, :2], valid
Thanks for your Great Work! when I'm trying to use the 7scenes pipline with commond:
python3 -m hloc.pipelines.7Scenes.pipeline --use_dense_depth
The following error occurred:
I used pycomap==0.6.0, do you know how to solve it? Thanks in advance.