看看link,OpenCV与OpenGL或WebGL之间的主要区别是:
这是我的步骤:
if (cmd.ExecuteNonQuery() != DBNull.Value)
{
MessageBox.Show("OK!");
}
else
{
MessageBox.Show("Failed!");
}
这似乎是朝正确方向迈出的一步,因为位置似乎正确。但是,对象面对的方向(在图像中用红色线框框出)是翻转的。绿色箭头应该指向相反的方向。
我认为这与此有关:
let opencvViewMatrix = new THREE.Matrix4();
let webglViewMatrix = new THREE.Matrix4();
let webglTransformMatrix = new THREE.Matrix4();
let transferMatrix = new THREE.Matrix4();
/* Create opencvViewMatrix from data */
opencvViewMatrix.set(
data[0][0], data[0][1], data[0][2], data[0][3],
data[1][0], data[1][1], data[1][2], data[1][3],
data[2][0], data[2][1], data[2][2], data[2][3],
data[3][0], data[3][1], data[3][2], data[3][3],
);
/* Fixing the y and z axis issue */
transferMatrix.set(
1, 0, 0, 0,
0, -1, 0, 0,
0, 0, -1, 0,
0, 0, 0, 1,
);
webglViewMatrix = opencvViewMatrix.multiply(transferMatrix);
/* To get the cameras transform matrix we need the inverse of the view matrix*/
webglTransformMatrix.getInverse(webglViewMatrix);
// lets get the position vector from the matrix
let t = new THREE.Vector3().setFromMatrixPosition(webglTransformMatrix);
// lets get the rotation vector from the matrix
let r = new THREE.Euler();.setFromRotationMatrix(webglTransformMatrix);
...
...
但是,我不太确定如何进行。任何帮助将不胜感激。