Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

Get position & rotation in DirectX

I'm using the Holographic Face Tracking demo and am trying to get the position and rotation of the RGB camera. I've tried to modify the code in HolographicFaceTrackerMain.cpp as follows:

//if (m_trackingFaces)
{
    if (MediaFrameReference^ frame = m_videoFrameProcessor->GetLatestFrame())
    {
        if (m_trackingFaces)
            ProcessFaces(m_faceTrackerProcessor->GetLatestFaces(), frame, currentCoordinateSystem);

        SpatialCoordinateSystem^ cameraCoordinateSystem = frame->CoordinateSystem;
        IBox<float4x4>^ cameraToWorld2 = cameraCoordinateSystem->TryGetTransformTo(currentCoordinateSystem);

        float4x4 cameraToWorld = cameraToWorld2->Value;
        float4x4 worldToCamera;
        invert(cameraToWorld, &worldToCamera);

        float3 position = transform(float3::zero(), cameraToWorld);
        float3 position2 = transform(float3::zero(), worldToCamera);
        String^ message = "position is (" + position.x + ", " + position.y + ", " + position.z + ")";
        message += "; position2 is (" + position2.x + ", " + position2.y + ", " + position2.z + ")\n";
        OutputDebugStringW(message->Data());
    .....
}

I move the HoloLens physically upwards by about 0.5 meters and here's the difference in position values (I'm outputting both just in case; I believe "position" should be the correct value):

Before:

position is (-0.0204049, 0.10264, -0.141831); position2 is (-0.00106736, -0.101193, 0.144312)

After:

position is (0.00338281, 0.103749, -0.143451); position2 is (-0.000295428, -0.102156, 0.144629)

Which basically says I moved by only 0.0239 meters, when really I moved approximately 0.5 meters. What am I doing wrong for trying to get the RGB camera's position and rotation? (Note: I've tried to get the rotation and it seems correct but I can't tell for sure when I have an incorrect position).

Sign In or Register to comment.