我真的很擅长使用kinect,所以请给我一些懈怠。我试图通过鼠标点击图像来获取帧中的深度点。我能够成功获得像素(x,y)。但是,当我尝试使用此代码从特定点获取深度我得到一些错误,我不确定为什么。我得到的depthFrame和ColorFrame存储在cvMats中。有人告诉我使用depthFrame.at,我无法找到任何信息。
同样来自微软网站,这是我成功获得所需值的参数。
public void MapDepthPointsToCameraSpace (
DepthSpacePoint[] depthPoints,
UInt16[] depths,
CameraSpacePoint[] cameraPoints
)
我只需要获取depthFrame并将其存储到Uint16类型的数组中吗?
错误C2974:' cv :: Mat :: at' :' _Tp'的无效模板参数,输入预期
// Get the depth at pixel (col, row)
UINT16 depth = depthFrame.at<depthFrame.type()>(rows,cols);
// Create a DepthSpacePoint based on row, col
DepthSpacePoint depthPoint = { 0 };
depthPoint.X = static_cast<float>(origin.x); // u
depthPoint.Y = static_cast<float>(origin.y); // v
//CameraSpacePoint to store (X, Y, Z)
CameraSpacePoint cameraPoint = { 0 };
//Map the DepthSpacePoint to the CameraSpacePoint
m_pCoordinateMapper->MapDepthPointToCameraSpace(depthPoint,depth,&cameraPoint);
// Access X, Y, Z
float x = static_cast<float>(cameraPoint.X);
float y = static_cast<float>(cameraPoint.Y);
float z = static_cast<float>(cameraPoint.Z);