Skip to main content
API Reference SwiftyNsdk

NsdkFrameData

A complete frame of data captured from an AR session....

Declaration

struct NsdkFrameData

Summary

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

NameTypeSummary
var cameraImageFormatImageFormat
Format of the camera image data.
Specifies how the pixel data in the camera planes is organized and interpreted.
var cameraImageHeightUInt32
Height of the camera image in pixels.
var cameraImageWidthUInt32
Width of the camera image in pixels.
var cameraIntrinsicsCameraIntrinsics?
Camera intrinsic parameters for the camera image.
Contains focal length, principal point, and resolution information
needed for accurate 3D reconstruction and geometric processing.
var cameraPlane0CameraPlane?
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 cameraPlane1CameraPlane?
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 cameraPlane2CameraPlane?
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 cameraTimestampMsUInt64
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 cameraTransformsimd_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 compassDataCompassData?
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 depthAndConfidenceImageDataLengthUInt32
Total length of depth and confidence data arrays.
This represents the combined size of the depth and confidence data buffers.
var depthCameraIntrinsicsCameraIntrinsics?
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 depthCameraPosesimd_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 depthConfidenceDataUnsafePointer<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 depthDataUnsafePointer<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 depthImageHeightUInt32
Height of the depth image in pixels.
var depthImageWidthUInt32
Width of the depth image in pixels.
var frameIdUInt32
Unique identifier for this frame.
Used to track and correlate frame data across different processing stages.
var gpsDataGpsData?
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 screenOrientationUIInterfaceOrientation
Current screen orientation of the device.
Used to properly orient AR content relative to the device's physical orientation.
var trackingStateARCamera.TrackingState
Current ARKit tracking state.
Indicates the quality and reliability of the device's pose tracking.

Operators

NameTypeSummary
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 != b
implies 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

NameTypeSummary
CameraIntrinsicsCameraIntrinsics
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.
CameraPlaneCameraPlane
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.
CompassDataCompassData
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.
GpsDataGpsData
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

NameTypeSummary
ImageFormatImageFormat
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