# Augmented Reality

NatML has first-class integration with Unity ARFoundation for adding machine learning to augmented reality applications. We do so by providing ML feature implementations for working with AR camera and depth images:

## Making Predictions in AR

Making predictions on the AR camera image closely mirrors the steps we've outlined above. The only difference comes in how we create an image feature for prediction. Instead of using the [`MLImageFeature`](/unity/api/mlfeature/mlimagefeature.md) class, we will instead use the [`MLXRCpuImageFeature`](broken://pages/aGi76D0ICO3Zm0PKzPL1) class. First, we need to acquire the current `XRCpuImage` from ARFoundation:

```csharp
// Get the ARCameraManager
ARCameraManager cameraManager = ...;
// Get the latest camera image
XRCpuImage image;
cameraManager.TryAcquireLatestCpuImage(out image);
```

Next, we create an `MLXRCpuImageFeature` from the `XRCpuImage`:

```csharp
// Create an AR image feature
var imageFeature = new MLXRCpuImageFeature(image);
```

From here, the rest of the prediction workflow remains the same.

## Working with AR Depth

* AR depth


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.natml.ai/unity/integrations/augmented-reality.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
