STRUCT
ArdkFrameData
public struct ArdkFrameData: Equatable
A complete frame of data captured from an AR session.
ArdkFrameData encapsulates all the sensor data, images, and tracking information
from a single AR frame. This includes camera images, depth data, device pose,
GPS location, compass heading, and camera intrinsics.
Overview
Frame data is the primary input to ARDK for all AR processing tasks including:
- Visual positioning and localization
- 3D scanning and reconstruction
- Map building and tracking
- AR location positioning
Example Usage
// In your ARSession delegate
func session(_ session: ARSession, didUpdate frame: ARFrame) {
let frameData = ArdkFrameData(
timestampMs: UInt64(frame.timestamp * 1000),
cameraImage: RawImage(from: frame.capturedImage),
depthImage: frame.sceneDepth?.depthMap.flatMap { RawImage(from: $0) },
// ... other data
)
ardkSession.sendFrame(frameData)
}
Properties
frameId
public var frameId: UInt32
Unique identifier for this frame.
Used to track and correlate frame data across different processing stages.
compassData
public var compassData: CompassData?
Compass and magnetometer data for device heading.
Optional compass data providing device orientation relative to magnetic north. Used for location-based AR features and waypoint navigation.
gpsData
public var gpsData: GpsData?
GPS location data for geographic positioning.
Optional GPS data providing device location coordinates and accuracy. Used for AR location positioning and location-based AR experiences.
cameraTimestampMs
public var cameraTimestampMs: UInt64
Timestamp when the camera frame was captured (in milliseconds).
This timestamp is used to synchronize camera data with other sensor data and maintain temporal consistency across processing stages.
cameraTransform
public var cameraTransform: simd_float4x4
4x4 transformation matrix representing camera pose in world coordinates.
This matrix transforms points from camera coordinate space to world coordinate space. It includes both the camera's position and orientation.
cameraPlane0
public var cameraPlane0: CameraPlane?
First plane of camera image data (typically Y/luminance for YUV formats).
For multi-plane image formats, this contains the primary image data. For single-plane formats, this contains all the image data.
cameraPlane1
public var cameraPlane1: CameraPlane?
Second plane of camera image data (typically U or interleaved UV for YUV formats).
Only used for multi-plane image formats. May be nil for single-plane formats.
cameraPlane2
public var cameraPlane2: CameraPlane?
Third plane of camera image data (typically V for YUV formats).
Only used for three-plane image formats. May be nil for single or dual-plane formats.
cameraIntrinsics
public var cameraIntrinsics: CameraIntrinsics?
Camera intrinsic parameters for the camera image.
Contains focal length, principal point, and resolution information needed for accurate 3D reconstruction and geometric processing.
cameraImageWidth
public var cameraImageWidth: UInt32
Width of the camera image in pixels.
cameraImageHeight
public var cameraImageHeight: UInt32
Height of the camera image in pixels.
cameraImageFormat
public var cameraImageFormat: ImageFormat
Format of the camera image data.
Specifies how the pixel data in the camera planes is organized and interpreted.
depthData
public var depthData: UnsafePointer\<Float\>?
Raw depth values as floating-point distances.
Each value represents the distance from the depth camera to the corresponding pixel in meters. May be nil if depth data is not available.
depthConfidenceData
public var depthConfidenceData: UnsafePointer\<UInt8\>?
Confidence values for each depth measurement.
Each byte represents the confidence of the corresponding depth value, with higher values indicating more reliable depth measurements.
depthCameraIntrinsics
public var depthCameraIntrinsics: CameraIntrinsics?
Camera intrinsic parameters for the depth camera.
May differ from camera intrinsics if the depth camera has different resolution or optical properties than the color camera.
depthCameraPose
public var depthCameraPose: simd_float4x4
4x4 transformation matrix representing depth camera pose.
Transforms points from depth camera coordinate space to world coordinate space. May differ from camera transform if cameras are not perfectly aligned.
depthImageWidth
public var depthImageWidth: UInt32
Width of the depth image in pixels.
depthImageHeight
public var depthImageHeight: UInt32
Height of the depth image in pixels.
depthAndConfidenceImageDataLength
public var depthAndConfidenceImageDataLength: UInt32
Total length of depth and confidence data arrays.
This represents the combined size of the depth and confidence data buffers.
screenOrientation
public var screenOrientation: UIInterfaceOrientation
Current screen orientation of the device.
Used to properly orient AR content relative to the device's physical orientation.
trackingState
public var trackingState: ARCamera.TrackingState
Current ARKit tracking state.
Indicates the quality and reliability of the device's pose tracking.
Methods
init()
public init()