我正在使用vuforia制作AR视频应用。我希望我的视频应该是垂直的,当我在Y轴上移动相机时,我的AR视频应该是垂直的。我编辑了vuforia示例videoplayback并添加了后续代码,但我遇到了意想不到的行为。
Matrix44F inverse_view = SampleMath.Matrix44FInverse(Tool.convertPose2GLMatrix(trackableResult.getPose()));
// line of sight
Vec3F los = new Vec3F(-inverse_view.getData()[8], -inverse_view.getData()[9], -inverse_view.getData()[10]);
Vec3F z_axis = new Vec3F(0, 0, 1);
Vec3F x_axis = Vec3FNormalize(Vec3FCross(los, z_axis));
Vec3F y_axis = Vec3FCross(z_axis, x_axis);
float[] orientationMatrix = new float[]{
x_axis.getData()[0], x_axis.getData()[1], x_axis.getData()[2], 0,
y_axis.getData()[0], y_axis.getData()[1], y_axis.getData()[2], 0,
z_axis.getData()[0], z_axis.getData()[1], z_axis.getData()[2], 0,
0, 0, 0, 1
};
// calculate the model view projection matrix
float[] viewMatrixVideo = Tool.convertPose2GLMatrix(trackableResult.getPose()).getData();
float[] modelViewVideo = new float[16];
Matrix.multiplyMM(modelViewVideo, 0, viewMatrixVideo, 0, orientationMatrix, 0);
float[] modelViewProjectionVideo = new float[16];
Matrix.scaleM(modelViewVideo, 0,
targetPositiveDimensions[currentTarget].getData()[0],
targetPositiveDimensions[currentTarget].getData()[0]
* videoQuadAspectRatio[currentTarget],
targetPositiveDimensions[currentTarget].getData()[0]);
Matrix.multiplyMM(modelViewProjectionVideo, 0, projectionMatrix, 0, modelViewVideo, 0);
但是使用上面的代码我会像以下视频一样获得轮播:
https://www.youtube.com/watch?v=b032rThCseU
但我希望我的视频应该如下图所示旋转:
请帮助我。