One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

LensDistortionData

struct · iOS 26.0+ · SDK 27.1

struct LensDistortionData

A description of estimated lens distortion that can be used to rectify images. See also: `AVCameraCalibrationData` Example of a per-pixel undistort function using this data: ``` func undistortPoint(lensDistortionData: LensDistortionData, imageSize: SIMD2<Float>, point: SIMD2<Float>) -> SIMD2<Float> { // The lookup table holds the relative radial magnification for n linearly spaced radii. // The first position corresponds to radius = 0 // The last position corresponds to the largest radius found in the image. // Determine the maximum radius. let opticalCenter: SIMD2<Float> = lensDistortionData.center let deltaXMax: Float = max(opticalCenter.x, imageSize.x - opticalCenter.x) let deltaYMax: Float = max(opticalCenter.y, imageSize.y - opticalCenter.y) let radiusMax: Float = sqrt(deltaXMax * deltaXMax + deltaYMax * deltaYMax) // Determine the vector from the optical center to the given point. let centerToPoint: SIMD2<Float> = point - opticalCenter // Determine the radius of the given point. let pointRadius: Float = length(centerToPoint) // Look up the relative radial magnification to apply in the provided lookup table var magnification: Float = 1.0 let radialLut = lensDistortionData.radialLookupTable if pointRadius < radiusMax { // Linear interpolation based on piecewise linear function of normalized radius let value = pointRadius * Float(radialLut.count - 1) / radiusMax let index = Int(value) let fraction = value - Float(index) let magLeft = radialLut[index] let magRight = radialLut[index + 1] magnification = ( 1.0 - fraction ) * magLeft + fraction * magRight } else { magnification = radialLut[radialLut.count - 1] } // Apply radial magnification let centerToRectifiedPoint: SIMD2<Float> = centerToPoint + magnification * centerToPoint // Construct output return opticalCenter + centerToRectifiedPoint } ```

Members (3)

get · iOS 26.0+

radialLookupTable

TypeScript
get radialLookupTable(): Array<number>
Swift declaration
let radialLookupTable: [Float]

A linear interpolation lookup table from the `center` to the maximum distance corner of the image. This describes the magnification of radius at a given radius. This is the same structure as `lensDistortionLookupTable` in `AVCameraCalibrationData` and can be used in a similar manner, with the data already converted into a float array.

init · iOS 26.0+

init

TypeScript
static init(center: SDKHandle, radialLookupTable: Array<number>): LensDistortionData
Swift declaration
init(center: SIMD2<Float>, radialLookupTable: [Float])

Initializes a new immutable data structure describing lens distortion estimation.

get · iOS 26.0+

center

TypeScript
get center(): SDKHandle
Swift declaration
let center: SIMD2<Float>

The center pixel of the radial distortion mapping.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →