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.

save and load spatial mapping data in same place

kgilkgil
edited June 2017 in Questions And Answers

hello, I want to save and load spatial mapping data in same place.
I want to scan the room in advance. and people using my app need not scan for load and track hololens.

this is scenario.
1. scan the room
2. save the spatial mapping data of room.
3. make hologram scene with mapping data in unity editor.
4. my app has the data (at local or server).
5. another hololens download my app.
6. another hololens load the spatial mapping data of room. hologram scene I made also loaded in the room.

question:
In tutorial(Holograms 230 spatial mapping), we can save spatial mapping data. but it is only obj file. I think that obj file haven't raw data for space tracking.
then how i save the space data for tracking?
and is it possible that I put the data into my app?
When I play the app, can i load space data and holograms I made?

thank you!

Best Answers

  • stepan_stulovstepan_stulov ✭✭✭
    edited June 2017 Answer ✓

    Hey, @kgil

    To save a transfer batch you need to do these two steps:

    1. Serialize transfer batch into an array of bytes using WorldAnchorTransferBatch.ExportAsync(). Bare in mind that this process is asynchronous and gives you the resulting bytes in pieces. So you need to carefully stitch them together into the final byte array yourself.
    2. Save the bytes into a file. The easiest way on HoloLens is to use UnityEngine.Windows.File.WriteAllBytes().

    To then later load the batch and take anchors out of it you need to reverse the process:

    1. Load the transfer batch bytes from the file using UnityEngine.Windows.File.ReadAllBytes().
    2. Convert those bytes into a transfer batch with WorldAnchorTransferBatch.ImportAsync(). Bare in mind that this importing may sometimes fail with correct data for no apparent reason and you need to retry a few more times. This is a known unreliability of transfer batch serialization.
    3. Finally pull the anchors by their ids from the batch using WorldAnchorTransferBatch.LockObject().

    In between of these instructions you can then pass the file from one HoloLens to another either using File Explorer of the Device Portal or send it via network.

    Building the future of holographic navigation. We're hiring.

  • MattFedoCSGMattFedoCSG ✭✭
    Answer ✓

    Im not sure if this is what you are looking for, but I was able to save almost everything that the Hololens captured into a series of files and then rebuild the entire scene back in a different platforms app. In this case the app runs on iOS and Android and rebuilds and views all the hololens data including the spatial meshes, anchors and so on. Here are a few screen grabs. :smile: If you want to know how I did it, PM me.

Answers

  • hello, @stepan_stulov ! Thank you for your explanation.
    I understand that I can't save space data(point cloud or feature point)
    Hololens only tracks space in real time with data made in real time.

    Although, I and user are using same room, user can't track with shared worldAnchor because hololens don't know where world Anchor position is. Is that Right?

    thank you again!

  • @stepan_stulov thank you! I think that WolrdAnchorTransferBatch is what I looking for!
    I tried saving the world anchor in my device for getting it via File Explorer in the Device Portal. But I don't know...
    how I save world anchor at local storage?
    I really appreciate your kindness!

  • stepan_stulovstepan_stulov ✭✭✭
    edited June 2017 Answer ✓

    Hey, @kgil

    To save a transfer batch you need to do these two steps:

    1. Serialize transfer batch into an array of bytes using WorldAnchorTransferBatch.ExportAsync(). Bare in mind that this process is asynchronous and gives you the resulting bytes in pieces. So you need to carefully stitch them together into the final byte array yourself.
    2. Save the bytes into a file. The easiest way on HoloLens is to use UnityEngine.Windows.File.WriteAllBytes().

    To then later load the batch and take anchors out of it you need to reverse the process:

    1. Load the transfer batch bytes from the file using UnityEngine.Windows.File.ReadAllBytes().
    2. Convert those bytes into a transfer batch with WorldAnchorTransferBatch.ImportAsync(). Bare in mind that this importing may sometimes fail with correct data for no apparent reason and you need to retry a few more times. This is a known unreliability of transfer batch serialization.
    3. Finally pull the anchors by their ids from the batch using WorldAnchorTransferBatch.LockObject().

    In between of these instructions you can then pass the file from one HoloLens to another either using File Explorer of the Device Portal or send it via network.

    Building the future of holographic navigation. We're hiring.

  • MattFedoCSGMattFedoCSG ✭✭
    Answer ✓

    Im not sure if this is what you are looking for, but I was able to save almost everything that the Hololens captured into a series of files and then rebuild the entire scene back in a different platforms app. In this case the app runs on iOS and Android and rebuilds and views all the hololens data including the spatial meshes, anchors and so on. Here are a few screen grabs. :smile: If you want to know how I did it, PM me.

  • kgilkgil
    edited June 2017

    @stepan_stulov , you are so kind.
    Thanks to the detailed explanation, I finally saved and loaded world anchor!

    @MattFedoCSG
    Thank you for response. I wonder how you connect hologram(box trail) with real environment in unity editor.
    I sent the message. thank you!

  • The project is currently under wraps, but basically you save absolutely everything that the HoloLens sees and tracks, then rebuild the entire thing in another project. Once finished, you can port the second app to any device. iOS, Android, Windows, OSX, anything. More demos will be coming in the near future.

  • @MattFedoCSG , I expect your next demo. thank you!

Sign In or Register to comment.