NsdkFrameData
A complete frame of data captured from an AR session....
Declaration
struct NsdkFrameDataSummary
A complete frame of data captured from an AR session.
NsdkFrameData 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 NSDK 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 = NsdkFrameData(
timestampMs: UInt64(frame.timestamp * 1000),
cameraImage: RawImage(from: frame.capturedImage),
depthImage: frame.sceneDepth?.depthMap.flatMap { RawImage(from: $0) },
// ... other data
)
nsdkSession.sendFrame(frameData)
}
Constructors
init()
Properties
| Name | Type | Summary |
|---|---|---|
| var cameraImageFormat | ImageFormat | |
| var cameraImageHeight | UInt32 | Height of the camera image in pixels. |
| var cameraImageWidth | UInt32 | Width of the camera image in pixels. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| var depthAndConfidenceImageDataLength | UInt32 | Total length of depth and confidence data arrays. This represents the combined size of the depth and confidence data buffers. |
| 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. |
| 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. |
| 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. |
| 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. |
| var depthImageHeight | UInt32 | Height of the depth image in pixels. |
| var depthImageWidth | UInt32 | Width of the depth image in pixels. |
| var frameId | UInt32 | Unique identifier for this frame. Used to track and correlate frame data across different processing stages. |
| 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. |
| var screenOrientation | UIInterfaceOrientation | Current screen orientation of the device. Used to properly orient AR content relative to the device's physical orientation. |
| var trackingState | ARCamera.TrackingState | Current ARKit tracking state. Indicates the quality and reliability of the device's pose tracking. |
Operators
| Name | Type | Summary |
|---|---|---|
| static func != | Bool | Returns a Boolean value indicating whether two values are not equal. Inequality is the inverse of equality. For any values a and b, a != bimplies that a == b is false.This is the default implementation of the not-equal-to operator ( !=)for any type that conforms to Equatable.- Parameters: - lhs: A value to compare. - rhs: Another value to compare. |
Nested Types
Structs
| Name | Type | Summary |
|---|---|---|
| CameraIntrinsics | CameraIntrinsics | Camera intrinsic parameters for geometric calibration. This structure contains the internal geometric properties of the camera, including focal length, principal point, and resolution. These parameters are essential for accurate 3D reconstruction and AR tracking. |
| CameraPlane | CameraPlane | A single plane of camera image data. Camera images often contain multiple planes of data (Y, U, V for YUV format, etc.). This structure describes the memory layout and dimensions of a single image plane. |
| CompassData | CompassData | Compass and magnetometer data for heading information. This structure contains orientation data from the device's compass, providing heading information that can be used for location-based AR experiences and waypoint navigation. |
| GpsData | GpsData | GPS location data for geographic positioning. This structure contains location information from the device's GPS system, providing geographic coordinates and accuracy estimates for location-based AR features and location positioning. |
Enums
| Name | Type | Summary |
|---|---|---|
| ImageFormat | ImageFormat | Supported image formats for camera and depth data. These formats define how pixel data is organized in memory and what each pixel value represents. Different formats are used for color images versus depth images. |
Relationships
conforms to: Swift.Equatable
Specifies how the pixel data in the camera planes is organized and interpreted.