Files
Bachelor-Arbeit-Adrian-Haefner/Library/PackageCache/com.unity.xr.arkit@58a677f717be/Documentation~/arkit-camera.md
adriadri6972 d3d9c5f833 upload project
2025-07-31 15:21:08 +02:00

8.6 KiB

uid
uid
arkit-camera

Camera

This page is a supplement to the AR Foundation Camera manual. The following sections only contain information about APIs where ARKit exhibits unique platform-specific behavior.

[!include]

Optional feature support

ARKit implements the following optional features of AR Foundation's XRCameraSubsystem:

Feature Descriptor Property Supported
Brightness supportsAverageBrightness
Color temperature supportsAverageColorTemperature Yes
Color correction supportsColorCorrection
Display matrix supportsDisplayMatrix Yes
Projection matrix supportsProjectionMatrix Yes
Timestamp supportsTimestamp Yes
Camera configuration supportsCameraConfigurations Yes
Camera image supportsCameraImage Yes
Average intensity in lumens supportsAverageIntensityInLumens Yes
Focus modes supportsFocusModes Yes
Face tracking ambient intensity light estimation supportsFaceTrackingAmbientIntensityLightEstimation Yes
Face tracking HDR light estimation supportsFaceTrackingHDRLightEstimation Yes
World tracking ambient intensity light estimation supportsWorldTrackingAmbientIntensityLightEstimation Yes
World tracking HDR light estimation supportsWorldTrackingHDRLightEstimation
Camera grain supportsCameraGrain iOS 13+
Image stabilization supportsImageStabilization
Exif data supportsExifData iOS 16+

Note

Refer to AR Foundation Camera platform support for more information on the optional features of the camera subsystem.

Light estimation

ARKit light estimation can only be enabled or disabled. The availability of either Ambient Intensity or Environmental HDR data is governed by the active tracking mode. See the following table for more details.

Tracking configuration Ambient intensity (lumens) Color temperature Main light direction Main light intensity (lumens) Ambient spherical harmonics
World Tracking Yes Yes No No No
Face Tracking Yes Yes Yes Yes Yes

Camera configuration

XRCameraConfiguration contains an IntPtr field nativeConfigurationHandle which is a platform-specific handle. For ARKit, this handle is a pointer to the native ARVideoFormat Objective-C object.

Advanced camera hardware configuration

On supported devices with iOS 16 or newer, you can manually configure advanced camera hardware properties such as exposure. This is useful in situations where you want more control over the camera.

Note

In addition to iOS 16 or newer, advanced camera hardware configuration also requires a device with an ultra-wide camera. Most iOS devices starting with iPhone 11 have an ultra-wide camera. For more device-specific information you can check Apple's Tech Specs.

To configure the camera's advanced hardware properties, you must first lock the camera for configuration using ARKitCameraSubsystem.TryGetLockedCamera. If this method returns true, you can configure the device's advanced camera hardware properties using the ARKitLockedCamera instance passed as its out argument.

The following code samples demonstrate how to configure advanced camera hardware properties:

Check Support

The following example method checks whether the ARKitCameraSubsystem is available and whether it supports the advanced camera configuration feature. This method is used by the other code examples on this page.

[!code-csCameraExposure]

Exposure

The following example method tries to lock the camera and, if successful, sets the exposure. [!code-csCameraExposure]

White Balance

The following example method tries to lock the camera and, if successful, sets the white balance.

[!code-csCameraWhiteBalance]

Focus

The following example method tries to lock the camera and, if successful, sets the focus. [!code-csCameraFocus]

High resolution CPU image

You can asynchronously capture a high resolution XRCpuImage (or simply, CPU Image) using ARKitCameraSubsystem.TryAcquireHighResolutionCpuImage on iOS 16 and newer.

The example below demonstrates a coroutine to set up and handle the asynchronous request:

[!code-csHighResolutionCpuImageSample]

Whenever you successfully acquire a high resolution CPU image, you should Dispose it as soon as possible, as CPU images require native memory resources. If you retain too many high-resolution images, ARKit can be prevented from rendering new frames.

For a complete usage example, see the AR Foundation Samples repository.

Select a resolution

The exact resolution of the high resolution CPU image you receive depends on your camera manager's currentConfiguration. For the highest resolution capture, choose a configuration with a non-binned video format such as 4K resolution (3840x2160).

For more information on binned vs non-binned video formats, see Apple's Discover ARKit 6 video, which explains the ARKit camera architecture in greater detail.

EXIF data

You are able to access camera frame's EXIF data on devices running iOS 16 or newer.

For more information, refer to the EXIF specification.

[!include]