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

how to create a screenshot using the camera of the Hololens?

Hi,
In unity, can we do a screenshot of the camera of the hololens?
I want to get an image and scan for a QR code in the center of the image.
(or barcodes)
Does the ZXing.Mobile can be used?

Best Answer

Answers

  • Options
    JeromeJerome ✭✭

    appear to be what I'm looking for. I'lltry it :) thanks

  • Options
    JeromeJerome ✭✭

    does the ocr library is available with unity and hololens?
    the namespace: Windows.Media.Ocr

  • Options
    Jimbohalo10Jimbohalo10 ✭✭✭
    edited June 2016

    @Jerome said:
    does the ocr library is available with unity and hololens?
    the namespace: Windows.Media.Ocr

    According to this new Document for Win 10 June 2016 delivery No,
    Cannot see the need for this in Holographic, also nearest relative Kinect 2 for Windows do not have functionality
    https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/OCR/cpp/OcrCapturedImage.xaml

    My view a better way is to port the Unity Asset Store item
    QR Code/Barcode Scanner and Generator
    into Unity and read the camera using @HoloSheep link above.
    I have looked at this package and seems to contain everything you need just convert from webcam to unity Locate Camera Texture2D
    There are not any .dll to break conversion.

  • Options
    JeromeJerome ✭✭

    I tried the camera, and its working fine. I'm calling the MS Cognitive services to do the OCR part, its working fine too!!! :-)
    I have to parse the JSon result now.
    Thanks for the guides.

  • Options
    JeromeJerome ✭✭

    oh... no... I have a problem :-) the image captured by the hololens is not recognized by the Cognitive web service. I got an unsupportedmediatype error, while the format is set to PNG and working from Unity itself (using my local webcam, not the hololens one)

  • Options

    @Jerome download the Windows 10 UWP sample kit from GitHub Windows-universal-samples

    Unpack and got to <Windows-universal-samples-master\Windows-universal-samples-master\Samples\OCR\cs>
    Build the OCR sample and try your PNG file in the UWP sample.
    Some how you will have to use this to test your OCR png file.

    Download this sample webcam code which works unity3d-webcamtexture-convert-to-texture2d/webcamtexturetotexture2d/
    defaults to .png can be made to use others

    Build on Unity and test your webcam on it!
    the file type acceptable are from code " FileTypeFilter = { ".jpg", ".jpeg", ".png" }"

    Have you loaded all the shared #using sdk.template libraries

  • Options
    JeromeJerome ✭✭

    My code is working... but not in my Hololens. I suspect something related to the x86 compilation...

    Also I tried to store the image as a jpg file, but the code (https://developer.microsoft.com/en-us/windows/holographic/locatable_camera_in_unity#Capture_a_Photo_and_Interact_with_the_Raw_bytes) failed.
    the image is not saved on the Hololens. I dont have any error code.

  • Options
    JeromeJerome ✭✭

    yyeeahh... finaly!!! I have created my own web site which act as a proxy to the OCR web site.
    Here I'm able to get the image sent by my Hololens and send it to the MS API to do the OCR.
    Apparently, a standard API do this
    if (!Request.Content.IsMimeMultipartContent())
    {
    this.Request.CreateResponse(HttpStatusCode.UnsupportedMediaType);
    }
    in my case, the request is not a mimemultipartcontent, and so the error I receive is raised.
    with my own web API, I can bypass this test. I can get the image and send it back to the OCR web api.
    not sure the reason why the data sent from the Unity Editor works differently from the compiled code used in my Hololens, but the behavior is different between the 2 platforms and cause the issue.

  • Options

    @Jerome Great news you fixed it. Strange about Unity Editor having problems. There have been reports of similar problems since build 14 related to D3D and XAML behaving differently on the actual HoloLens device. I have reported a bug in the debug/Editor code in HTC editor build 18. Release D3D deployment works fine on HoloLens device.
    Its a good work around which could help others :)

  • Options

    @Jerome , I am trying out the locatable camera app to capture a pic and store it. it works in Unity but gives a blank screen when deployed to the Hololens.

    How were you able to make it work on the Hololens?
    Thanks!

  • Options
    JeromeJerome ✭✭

    I followed the same locatable sample, no change in the code. and I'm using the OnCapturedPhotoToMemory code.
    I have not tested the other samples.

    Maybe you can have a conflict in accessing the camera. the camera may be used by another app (or by somebody streaming your experience other the web) resulting in a black image.

  • Options

    @mrinal said:
    @Jerome , I am trying out the locatable camera app to capture a pic and store it. it works in Unity but gives a blank screen when deployed to the Hololens.

    How were you able to make it work on the Hololens?
    Thanks! If you

    You probably need to build as d3d NOT XMAL in Unity, which means deleting the Unity app build folder.
    In Visual Studio 2015 Community Set Release,X86, Device as build parameters
    XMAL and Debug have problems on the HoloLens Device.
    You can still start with debug, if you deploy first. Though most people seem to use "Start without Debug"

  • Options

    @Jimbohalo10 I did build it as d3d in Unity.
    And from visual studio I built the solution, deployed it and then "start without debug". I dont get any errors in the building or deploying but see just a black screen on the Hololens.

  • Options

    @Jerome yes, I am following the same code sample, no changes.

    The camera isnt being accesses by any other app.
    Also i am not getting a "black image", rather just a blank screen when it is deployed.

    I am not sure where the app on the Hololens will store any image captured and how do I access it. The app when run on Unity saves the snap on the local machine in a jpg format (as specified in the code).

  • Options
    JeromeJerome ✭✭

    oohhh... yeah, I have no found the pictures too. dont know where they are stored on the hololens device.

  • Options

    @Jerome you mentioned above that you could get the image sent by Hololens and send it to the MS API to do the OCR. Can you explain how did you access the image taken by the Hololens?
    Thanks!

Sign In or Register to comment.