我正在处理其他人使用 OpenNI 记录器模块记录的一些数据。不幸的是,他们在录制过程中不小心将镜像功能设置为开启,所以我遇到了一些问题 1. 使用 MirrorCap 镜像深度和 2. 使用 AlternateViewPointCap 将深度与 rgb 对齐。我尝试从我的深度节点访问这些功能,如下所示:
xn::Context ni_context;
xn::Player player;
xn::DepthGenerator g_depth;
xn::ImageGenerator g_image;
ni_context.Init();
ni_context.OpenFileRecording(oni_filename, player);
ni_context.FindExistingNode(XN_NODE_TYPE_DEPTH, g_depth);
ni_context.FindExistingNode(XN_NODE_TYPE_IMAGE, g_image);
g_depth.GetMirrorCap().SetMirror(false);
g_depth.GetAlternativeViewPointCap().SetViewPoint(g_image);
然而,这并没有奏效。即使在我将镜像设置为 false 之后,g_depth 上的 IsMirrored() 命令仍然返回 true,并且 alternateviewpointcap 不会更改我从生成器接收到的深度图。
我也尝试通过一个模拟节点来做到这一点:
xn::MockDepthGenerator m_depth;
m_depth.CreateBasedOn(g_depth);
m_depth.GetMirrorCap().SetMirror(false);
m_depth.GetAlternativeViewPointCap().SetViewPoint(g_image);
xn::DepthMetaData temp;
g_depth.GetMetaData(temp);
m_depth.SetMetaData(temp);
这也不会影响我从 m_depth 获得的深度图。对于如何使我的颜色和深度信息对齐的任何和所有建议,我将不胜感激,无论多么 HACKY。这些数据很难记录,我需要以一种或另一种方式使用它。
我当前的解决方案是创建模拟深度节点并使用我自己的例程翻转所有像素,然后使用 SetMetaData 函数进行设置。然后,我使用 OpenCV 通过让用户单击 4 个点来创建从 RGB 图像到深度图像的透视变换。然后我将此变换应用于 rgb 框架以使值对齐。它并不完美,但它可以工作 - 但是,为了其他可能需要使用数据的人,我想进行更适当的修复。