# NSDKFrameData Source: https://www.nianticspatial.com/docs/api/swift/NSDK.struct-NSDKFrameData/ NSDKFrameData --- ## 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 ```swift // 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 | Format of the camera image data.Specifies how the pixel data in the camera planes is organized and interpreted. | | 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 informationneeded 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 monotonic milliseconds (e.g. since deviceboot).This timestamp is used to synchronize camera data with other sensor dataand 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 differentresolution 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? | 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? | Raw depth values as floating-point distances.Each value represents the distance from the depth camera to the correspondingpixel 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 | NSDKScreenOrientation | Current screen orientation of the device.Used to properly orient AR content relative to the device's physical orientation. | | var trackingState | NsdkTrackingState | Current VIO tracking state.Indicates the quality and reliability of the device's pose tracking. | --- ## Methods | Name | Type | Summary | | --- | --- | --- | | withUnsafeCFrameData(_ body | T | Calls the given closure with a pointer to a valid `ARDK_FrameData` whosecamera and depth frame arrays are backed by storage that remains valid for theduration of the call | --- ## 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 != 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`. | --- ## 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 parametersare 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-basedAR 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-basedAR 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 whateach pixel value represents. Different formats are used for colorimages versus depth images. | --- ## Relationships conforms to: Swift.Equatable