我正在使用 kinect 和 ofxopeni。我在现实世界坐标中有一个点云,但我需要旋转这些点以抵消相机的倾斜。地板应该给我我需要的所有信息,但我不知道如何计算旋转轴和角度。
我最初的想法是……
ofVec3f target_normal(0,1,0);
ofVec3f vNormal; //set this from Xn3DPlane floorPlane (not shown here)
ofVec3f ptPoint; //as above
float rot_angle = target_normal.angle(vNormal);
for(int i = 0; i < numPoints; i++){
cloudPoints[i].rotate(rot_angle, vNormal, ptPoint); //align my points to normal is (0 1 0)
}
到目前为止,这似乎太简单了。我一直在浏览各种文章,可以看到它很可能涉及四分之一或旋转矩阵,但我不知道从哪里开始。我会非常感谢任何指向相关文章的指针,或者获得轴和旋转角度的最佳技术是什么?我想象它可以很容易地使用 ofQuarterion 或 openni 函数来完成,但我不知道如何实现。
最好的
西蒙