Skip to main content
←API Reference ←NianticSpatial.NSDK.AR.Utilities ←ImageSamplingUtils

Sample

Samples a native array as if it was an image. Employs nearest neighbour algorithm.

Declaration​

public static T Sample<T>(this NativeArray<T> data, int width, int height, Vector2 uv) where T : struct

Summary​

Samples a native array as if it was an image. Employs nearest neighbour algorithm.

Returns​

The nearest value in the array to the normalized coordinates.

Parameters​

NameTypeSummary
datathis NativeArray<T>
The native array containing the data.
widthint
The width of the image.
heightint
The height of the image.
uvVector2
Normalized image coordinates to sample.

Overload 1​

public static T Sample<T>(this XRCpuImage image, Vector2 uv, Matrix4x4 transform, int plane = 0) where T : struct

Summary​

Samples a CPU image. Employs nearest neighbour algorithm.

Returns​

The nearest value in the image to the transformed UV coordinates.

Parameters​

NameTypeSummary
imagethis XRCpuImage
The image to sample from.
uvVector2
Normalized image coordinates to sample.
transformMatrix4x4
Transforms the uv coordinates before sampling.
planeint
The index of the image plane to access.

Overload 2​

public static T Sample<T>(this NativeArray<T> data, int width, int height, Vector2 uv, Matrix4x4 transform) where T : struct

Summary​

Samples a native array as if it was an image. Employs nearest neighbour algorithm.

Returns​

The nearest value in the array to the transformed UV coordinates.

Parameters​

NameTypeSummary
datathis NativeArray<T>
The native array containing the data.
widthint
The width of the image.
heightint
The height of the image.
uvVector2
Normalized image coordinates to sample.
transformMatrix4x4
Transforms the uv coordinates before sampling.