深度到世界配准全息透镜2的统一性



我正在编写一个关于hololens2的程序,研究统一性模式。Hololens为我们提供了一个深度图像,即每个像素从深度传感器到前方物体的距离。

我所做的是将每个像素投影到图像平面,然后根据深度传感器捕获的深度距离进行反向投影,它会给我深度传感器坐标系中的xyz。现在需要将该坐标转换为全局坐标系。为了做到这一点,我通过CCD_ 1和另一方面保存的深度传感器外部矩阵从单位中获得相机坐标。

从这两个矩阵中,我创建了一个CCD_ 2。现在,对于深度上的每个xyz,我执行global_xyz = depth_to_world @ xyz以在现实世界中获得点。问题是它返回的点有10-15厘米的误差。我做错了什么?(代码在python中(

x = self.us[Depth_i, Depth_j] # projection from pixels to image plane
y = self.vs[Depth_i, Depth_j] # projection from pixels to image plane
D = distance_img[Depth_i, Depth_j] #distance_img is depth image
distance = 1000*float(D) / np.sqrt(x * x + y * y + 1) #distance according to spherical image plane D is in millimeter
depth_to_world = cam_pose @ np.linalg.inv(Constants.camera_extrinsic)
X = (np.array([x * distance, y * distance, 1.0 * distance, 1])).reshape(4, 1)
point = (depth_to_world @ X )[0:3, 0]

我搞定了!根据(https://github.com/petergu684/HoloLens2-ResearchMode-Unity)首先,我将统一世界的起源传递给了一个winrt插件,depth_to_world是depth_to_world=inv(外部(*cam_pose开关cam_pose由TryLocateAtTimeStamp给定。另一点是单位坐标是左手坐标(令人惊讶!(,所以我们应该将a(-1(乘以z我的depth_to_world转换很接近,但并不正确。

最新更新