microsoft / HoloLensForCV

Sample code and documentation for using the Microsoft HoloLens for Computer Vision research
MIT License
475 stars 154 forks source link

ComputeOnDevice object location #10

Open shllybkwrm opened 7 years ago

shllybkwrm commented 7 years ago

For this sample, how does the program or HL choose where to locate the slate object? For me, it's initializing fairly far away, in an area of the room where I haven't been since turning on the HL. I didn't even notice it the first few times I deployed - I thought the app wasn't working because I didn't see anything.

sshiv commented 7 years ago

I presume you are referring to the ComputeOnDevice sample. It should be place at the distance of 2 meters from your current location in the gaze direction. Is tracking working consistently ?

shllybkwrm commented 7 years ago

I haven't had any issues with tracking previously but this is the first time I'm running OpenCV or a UWP app (rather than Unity). The screen came up to my left, over 2 m away and not facing me (but facing the direction I was looking, if that makes sense). And as mentioned in #11 it didn't actually show anything.

shllybkwrm commented 7 years ago

@sshiv Is there another place I should be asking questions about these examples? Is the HL forums better?

polszta commented 7 years ago

@shllybkwrm, just to make sure we're looking at the same repro steps, the ComputeOnDevice sample does not show anything when first launched. Only when you air-tap, the sample positions a live preview of the color camera 2 meters in front of you. The next air-tap will freeze the image. The next air-tap will create another live preview window, etc.

If this doesn't work, we'll have to narrow the possibilities down. A good starting point would be to set a breakpoint at AppMain::OnSpatialInput (in Samples\ComputeOnDevice\AppMain.cpp). From there, you should be able to step into the SlateRenderer::PositionHologram call and observe the headPosition, headDirection, gazeAtTwoMeters and _rotationInRadians calculations.

shllybkwrm commented 7 years ago

@polszta When I run the ComputeOnDevice sample, it doesn't react at all to air-taps, either in front of me or on the blue screen I mentioned previously. (By the way, it would be great if there was documentation about the air-tap functionality for the sample. I wasn't able to find more than one line about what ComputeOnDevice does.)

I set the breakpoint as you suggested but when I debug I'm getting an error before I even get there. However I'm not sure this is related to the specific project so I'll look into it some more and report back.

Exception thrown at 0x76E62552 (KernelBase.dll) in ComputeOnDevice.exe: 0x40080201: WinRT originate error (parameters: 0xC00D36B3, 0x00000027, 0x0784EC94). Unhandled exception at 0x65401FD5 (ucrtbased.dll) in ComputeOnDevice.exe: An invalid parameter was passed to a function that considers invalid parameters fatal. occurred > ucrtbased.dll!_invoke_watson(const wchar_t * expression, const wchar_t * function_name, const wchar_t * file_name, unsigned int line_number, unsigned int reserved) Line 224 C++ Non-user code. Symbols loaded.

polszta commented 7 years ago

Point taken on sample documentation, filed issue #12 to track the work here.

The error you're hitting is coming from Media Foundation and most likely explains the rest of the symptoms... Perhaps the camera permissions in case they got somehow revoked? Could you please double-check that from by launching the Settings app, choosing the Privacy tab then Camera and making sure the toggle next to the app name is in the "On" position.

If this doesn't help, we'll have to ask you to share some more information about your setup so that we can try reproducing this problem locally: Windows version of the PC you're building the samples on (obtained by running "ver.exe" in a command prompt) and Visual Studio version (Help -> About Microsoft Visual Studio).

shllybkwrm commented 6 years ago

The camera permissions still look good. Here's my info:

Microsoft Windows [Version 10.0.15063] Microsoft Visual Studio Community 2017 Version 15.3.3 Microsoft .NET Framework Version 4.7.02046 Visual Studio Tools for UWP (includes Win10 SDK) Version 15.0.26730.08

I do have different versions of VS installed on this machine as well, any reason that would be an issue?

polszta commented 6 years ago

I've set up a computer from scratch, trying to closely match your configuration (we have seen some people over here run into issues when building the samples on older version of Windows, etc., so I wanted to take this out of the equation). I could not reproduce the issue you are hitting (for reference, see the attached log file showing the application working correctly).

Enabling all C++ exceptions to break into debugger would be a good start to diagnose this further (in VS: Debug -> Windows -> Exception Settings, then toggle the "C++ exceptions"). Please do share the call stack of the failure and the full debugger output log.

ComputeOnDeviceOutput.txt

shllybkwrm commented 6 years ago

Sorry for the delay, I was away from my HL. I changed the setting you mentioned and I've attached the output. ComputeOnDevice_ExceptionOutput.txt

Exception: Exception thrown at 0x76E92552 in ComputeOnDevice.exe: Microsoft C++ exception: Cn::XH at memory location 0x017CE8B4. occurred

Call Stack:

>   KernelBase.dll!_RaiseException@16()    Unknown Non-user code. Symbols loaded.
    msvcrt.dll!76a0ac19()   Unknown Non-user code. Cannot find or open the PDB file.
    [Frames below may be incorrect and/or missing, no symbols loaded for msvcrt.dll]        Annotated Frame
    [External Code]     Annotated Frame
    InputHost.dll!707aa3af()    Unknown No symbols loaded.
    InputHost.dll!707aa59b()    Unknown No symbols loaded.
    InputHost.dll!707a392d()    Unknown No symbols loaded.
    [External Code]     Annotated Frame
polszta commented 6 years ago

I think this particular exception is a first-chance exception, if you hit F5 (Run) it will be handled by the input host component.