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

OnPhotoCaptureCreated not called when running in Hololens

Hi,
I am trying to make an app that would capture photos in Hololens. I have followed the tutorial and almost copied the tutorial code. When I run it on my computer in Unity it works and takes a photo with my webcam. But when I run it on Hololens it doesn't work.
My problematic part of code is here:

void Start() {

    startHeadPosition = Camera.main.transform.position;
    newHeadPosition = startHeadPosition;
    dIndikator.text = "";

    CreateScene("Test");


    Debug.Log("\n Taking picture \n");
    PhotoCapture.CreateAsync(false, OnPhotoCaptureCreated);
    Debug.Log("\n Debug 2 \n");
}

void OnPhotoCaptureCreated(PhotoCapture captureObject)
{
    Debug.Log("\n Debug 1 \n");
    photoCaptureObject = captureObject;

    m_cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).Last();

    CameraParameters c = new CameraParameters();
    c.hologramOpacity = 0.0f;
    c.cameraResolutionWidth = m_cameraResolution.width;
    c.cameraResolutionHeight = m_cameraResolution.height;
    c.pixelFormat = CapturePixelFormat.JPEG;

    Debug.Log("\n PhotoModeStarted \n");

    captureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);
}

In Unity the log looks like this:
Taking picture
Debug 2
Debug 1
PhotoModeStarted

But when in Hololens I get only:
Taking picture
Debug 2

So it looks like it doesn't even enter the OnPhotoCaptureCreated. I have set capabilities to the camera and microphone and made sure I have them in the manifest file so I don't have any idea what would have caused this problem.
Any ideas are greatly appreciated.

Answers

  • Options

    I think I've noticed issues with PhotoCapture.SupportedResolutions not actually containing any resolutions (and throwing an exception). You could try hardcoding the photo width and height to something like 1280x720 and see if that works.

Sign In or Register to comment.