Unity
28 TopicsCapturing photos in a quick way (Unity, HoloLens 2)
My objective is to analyze the HoloLens' camera stream. I've been trying to capture what the HoloLens is seeing for image processing but the only properly documented way I've found is through the library UnityEngine.Windows.WebCam. The problem with this library is that taking a photo, no matter how small, always takes a heavy toll on the device's performance. I've looked up different ways to capture the camera stream from the HoloLens but the documentations are always lacking something. So I've tried implementing the Windows.Media library in Unity to at least take a quick photo, but it doesn't seem to work. Here is how I've implemented it: using Windows.Media.Capture.Core; using Windows.Media.Devices.Core; private MediaCapture _mediaCapture; private async void StartScanTest() { _mediaCapture = new MediaCapture(); await _mediaCapture.InitializeAsync(); StartCoroutine(ScanTestUWP()); } private IEnumerator ScanTestUWP() { while (true) { CheckPatternUWP(); yield return new WaitForSeconds(0.5f); } } private async void CheckPatternUWP() { var lowLagCapture = await mediaCapture.PrepareLowLagPhotoCaptureAsync(ImageEncodingProperties.CreateUncompressed(MediaPixelFormat.Bgra8)); var capturedPhoto = await lowLagCapture.CaptureAsync(); var softwareBitmap = capturedPhoto.Frame.SoftwareBitmap; byte[] imageBytes = new byte[4 * softwareBitmap.PixelWidth * softwareBitmap.PixelHeight]; softwareBitmap.CopyToBuffer(imageBytes.AsBuffer()); Texture2D photoTexture = new Texture2D(1,1); photoTexture.LoadImage(imageBytes); await lowLagCapture.FinishAsync(); if (photoTexture) { CheckFromTexture(photoTexture); } } This is all under the #if UNITY_UWP preprocessor directive. Is there a way to get the actual camera stream from the HoloLens? If not, how can I take pictures without stuttering?6.6KViews1like3CommentsHololens 2 FileOpenPicker: no access to Documents folder
We're developing a B2B Hololens 2 application (in Unity, with MRTK). As data input for our app we load in .csv files which contain configuration settings, these are different every time the app is used. We're able to use FileOpenPicker to bring up the Hololens File Explorer in the app to select the .csv file we need. However, when the file is in the Documents or Downloads folder access to read them is denied - but when we put them in the Pictures folder (and declare access through the Appxmanifest > Capabilities > Pictures Library) we can read and write the files just fine. Is there a way to allow access to the Documents and/or Downloads folder as well?5.5KViews0likes3CommentsI want to stream the camera feed from a Tello drone to HoloLens
Hello, I am using the following tools: TelloforUnity MRTK v1.0.2104.3 Beta Unity 2019.4.28f1 I want to be able to see the drone's camera feed on hololens. Using only TelloforUnity I am able to see the camera feed on Unity when I start the Scene, but when I try to launch the project to Hololens all I am able to see is a white screen in the area where the video should have played. For anyone who is familiar with TelloforUnity, I created a new project, added the MRTK and I added the TelloVideo to my scene. The video works fine in Unity but not on Hololens. Any Ideas how to fix this issue or how to stream a video to Hololens?Solved3.5KViews0likes6CommentsHololens 2 app works with holographic remoting, but not when deployed
I am developing an app for Hololens 2 on Unity 2019.4.22f1 using MRTK 2.7.1 and XR SDK. I have done all of the basic MRTK setup (I added MRTK Foundation, Extensions, Tools, and Standard Assets using the Mixed Reality Feature Tool; I used the utility "Configure Project for MRTK" in Unity under Mixed Reality > Toolkit > Utilities; I installed the XR Plugin Manager and the Windows XR Plugin and adjusted their settings in Project settings) and I followed this guide to ensure my project was set up to use XR SDK: https://docs.microsoft.com/en-us/windows/mixed-reality/mrtk-unity/configuration/getting-started-with-mrtk-and-xrsdk?view=mrtkunity-2021-05. I have made a Hololens 2 app before that worked when deployed, and this project is set up almost exactly the same way. The only major difference is that my working app has only one scene, while in this current project I am using multiple scenes loaded additively. I am using the MRTK scene system and have a Default Manager Scene at build order 0 with the standard "MixedRealityToolkit" (configuration profiles) and "MixedRealityPlayspace" objects. I have an object in this scene with a script that additively loads another scene on Awake(). This scene only contains a Unity UI canvas that has a RadialView solver and SolverHandler component on it (MRTK components to make it follow user's head), and this canvas has some child ui elements/images. When I run the app using holographic remoting (Window > XR > Windows XR Plugin Remoting) everything works. The UI is able to move around and I can press the buttons on the UI. When I deploy the app to the Hololens 2 and run it, the ui is fixed to the camera/my head and the app doesnt seem to acknowledge my hands at all. I also added a cube to test a non-ui element and it also fixed in front of the camera. It looks almost as if the scene is rendered like a 2D screen in front of me. My Build settings are set to Universal Windows Platform, HoloLens target device, ARM64, latest installed Windows SDK and Visual Studio, and release mode. Any idea what could be causing this issue?1.9KViews0likes2CommentsExploring Hololens in Architecture
Currently, I'm exploring how Hololens 2 works in the architecture field, but currently I'm still using Hololens 2 Emulator. Is it possible to connect Rhinoceros (+ grasshopper) to Hololens 2 without fologram? Is there some kind of tutorial or guide, or maybe keywords? maybe connecting through unity? Because what I'm found is most of people use fologram. and unity 2019.4 doesn't support Rhinoceros. or maybe I'm missing something? Thank you1.7KViews0likes2CommentsOauth 2.0 authentication in Hololens
Hi Developers, I am trying to insert OAuth 2.0 function into my application inside the HoloLens, but haven't found a successful way for the past two weeks. I had try using Launcher function like LaunchUri, I was able to do all the login authentication with the edge it pop out but was not able to return any information from it to my application. I also try to use web authentication broker(WAB) but was keep giving me error "Value does not fall within expected range". I was able to do it in a desktop application, but not in HoloLens. Can anyone give me some suggestion on what I can do? So my steps are Step 1: Direct the User to the Authorization Web Flow which is to launch a website for authorization through a provider Step 2 : When consent has been granted, the user will be redirected back to your callback URL (redirect_uri) with an additional code query parameter that contains the authorization code Thanks!!!!!!!1.4KViews0likes2CommentsSending email from Hololens app
Hello ! I'm new to this forum and to Mixed-Reality development, so please bear with me. I'm having trouble sending a mail from my UWP App. I tried the classic smtp client with System.Net.Mail, works on Unity but it seems that it's not supported on Hololens or UWP application (made the app crash). Tried this https://docs.microsoft.com/fr-fr/windows/uwp/contacts-and-calendar/sending-email but it does not seem too work ( no error or nothing , the mail is just not send ?). So finally I tried to use the https://github.com/LightBuzz/SMTP-WinRT Plug-in but here again , no clear error with Unity debugger or crash, the job result is good no exception catched (see code below) : protected override void ThreadFunction() { #if ENABLE_WINMD_SUPPORT using (LightBuzz.SMTP.SmtpClient client = new LightBuzz.SMTP.SmtpClient(EmailInfos.Smtp, EmailInfos.Port, true, EmailInfos.SenderMailAddress, EmailInfos.Password)) { Windows.ApplicationModel.Email.EmailMessage emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.To.Add(new Windows.ApplicationModel.Email.EmailRecipient(Receiver)); emailMessage.Subject = Subject; emailMessage.Body = Body; try { client.SendMailAsync(emailMessage); Result = "Mail Sent from HoloLens"; } catch (Exception ex) { Result = "Exception caught in Send(): " + ex.ToString(); } } #else But I do get an exception from visual studio output, just before the display of the result "Mail Sent from HoloLens" : Exception thrown at 0x76C5A08B in ***.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x1AAFE408. I don't know how to handle this exception or get more info on it ? Has anyone here ever managed to send a mail from an HoloLens App and can help me ? PS : For info, I work with Hololens 2 , Unity 2019.4.2, Visual Studio 2017 (15.9.36) and MRTK 2.3. Sorry if I forgot some info. Thanks!1.4KViews0likes2CommentsHoloLens 2 cannot stablish wired connection using USB cable or ethernet-type C adapter.
Hello everybody, In the company I work for, we have been developing a HoloLens 2 using Unity 2019.4.24 and MRTK 2.6.1 from about 5 years (we started in HoloLens 1) that basically connects to a PC software and sends and receives (using websockets) data to be rendered in the HoloLens. A year ago, I made research to see if we can use a wired connection to perform the communications, and it used to work. The setups I have tried (everyone used to work): Connect the HoloLens to the PC using the USB cable and having the device portal enabled. Using an ethernet to type C adapter, connect the HoloLens to a router using an ethernet cable, the PC is also connected to the router through ethernet. Using an ethernet to type C adapter, connect the HoloLens to the ethernet port on the PC, in this scenario I needed to set an IP address and the submask in the PC and the HoloLens. From my app side, everything worked without need to add special code to handle the wired connection. Last week one of our costumers told us that he is not able to use the wired connection (he was using the scenario 1), so, after I get the ticket, I tried to replicate the setup, for my surprise none of the setups were working. I restored the HoloLens device to the factory settings, doing this only scenario 2 works. Besides this client, 2 of my colleagues are reporting the same issue, all our HoloLens have the OS version: 20348.1542, we have tried and old version of our app when I did the research, the app is not working so I’m assuming this could be a bug in the OS. Other things I have noticed: The HoloLens is unreachable if I try to do a ping in scenario 1 a 2 (scenario 2 is reachable after restoring the HoloLens) In all scenarios the IPv4 is not shown/assigned, if I try to assign the IP manually in the IP assignment settings the configuration is not preserved, once I press “Save” and return to the previous screen, it remains “Automatic (DHCP)” and when is saved, the ping cannot reach the HoloLens from the PC. When I connect the cable 2 ethernet adapters are displayed (as far I remember there was only one). When the cable is not connected there’s still one ethernet adapter but cannot set an IP manually. I was looking the way to try to perform a ping from the HoloLens, I was trying to use an app (DL Networks monitor) to see if the HoloLens is connected properly to the network. As I mention above, this seems to be an issue to the Operating system, Where can I report this? The last idea to try to fix this is to downgrade the HoloLens to an older version of the OS and look if the wired connection works.1.4KViews0likes0Comments