1

I am making AR video app using vuforia. I want my video should come vertical and always face camera when I move camera around Y axis on all other oration my AR video should vertical. I have edited vuforia sample videoplayback and added folling code but I am getting unexpected behavior.

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);

but with above code I am getting rotation like in following video :

https://www.youtube.com/watch?v=b032rThCseU

but i want my video should rotate like in following image:

enter image description here

plz help me.

Mirza Ahmed Baig
  • 5,605
  • 3
  • 22
  • 39

0 Answers0