#Event – Resources used with @ivanatilca during the “Lessons Learned creating a multiplatform AI project for Azure Kinect and Hololens 2” for the Global XR Talks

Buy Me A Coffee

Hi !

We had an amazing time last week with Ivana at the Global XR Talks, sharing some of our lessons learned creating an Mixed Reality app to work in Hololens 2 and Azure Kinect.

As usual, now it’s time for slides and code

Slides

Code

The main scripts for Camera and Cognitive Services interaction are available here https://github.com/elbruno/events/tree/main/20200806%20Global%20XR%20HL2%20to%20Azure%20Kinect%20Lessons%20Learned

Session Recording

Resources

#Unity3D – Making a CustomVision.ai HTTP Post call to have a better #MRTK experience with #CognitiveServices @ivanatilca

Buy Me A Coffee

Hi !

Quick post today, with mostly sample code. And, it’s all about a scenario that we faced with Ivana a couple of days ago while we were using MRTK and we were trying to use some Cognitive Services.

As of today, not all the services in Cognitive Services are supported and have official Unity3D support. At the end, it’s not a problem, we can just make an HTTP Post call, and that’s it. However, this is not as easy as is supposed to be.

So, after facing some issues with the System.Net.HttpClient library, I decided to use UnityWebRequest. This library main objective is to work with HTTP Forms, however we can manage to send an image with a sample like this:

string DetectImage(byte[] image, string imageUrl)
{
string body = string.Empty;
using (var request = UnityWebRequest.Post(imageUrl, ""))
{
request.SetRequestHeader("Content-Type", "application/octet-stream");
request.uploadHandler = new UploadHandlerRaw(image);
request.SendWebRequest();
while (request.isDone == false)
{
var wfs = new WaitForSeconds(1);
}
if (request.isNetworkError || request.isHttpError)
{
Debug.Log(request.error);
}
else
{
body = request.downloadHandler.text;
}
}
return body;
}

As we can see in the previous post, there is no async / await support here. So I added a couple of ugly lines of code to support this. We can improve this to have a timeout or delay applied here. As for this sample, this works great.

As a bonus, you can watch the full presentation in the Global XR YouTube channel here

Happy coding!

Greetings

El Bruno


References

#Hololens2 – Project sizes using #MRTK

Buy Me A Coffee

Hi !

Quick post today. When I started with Hololens 1, Unity and the Hololens Toolkit a couple of years ago, I did this exercise to have a sense of the required disk space for my projects and tests.

I realize that I didn’t blogged this, so here is an updated version using the latest versions. Here are the tools and versions I’m using:

  • MRTK 2.4
  • Unity 2019.4.6f1
  • Visual Studio 2019 Preview (16.7.0)

And using this tools I follow the steps defined in “Initializing your project and deploying your first application” (see references). Let’s take a look at the disk usage.

  • Create an empty 3D project with Unity.
    Disk Size: 49 MB
  • 2. Build the project in Unity.
    Disk Size: 200 MB
  • Import the MRTK 2.4.0 Foundation package in Unity.
    Disk Size: 332 MB
  • Build the project in Unity.
    Disk Size: 668 MB
  • Build the output in Visual Studio 2019 for the HL2.
    Disk Size: 3 GB
  • Apply MRTK Configuration and Settings for a HL2 in Unity and Build.
    Disk Size: 3.10 GB
  • Build the output in Visual Studio 2019 for the HL2.
    Disk Size: 3.68 GB

So, as you can see, a ready-to-go final project will require around 3.5 GBs disk space. Get ready your credit card for a new SSD !

Happy coding!

Greetings

El Bruno


Resources