Skip to main content

TensorMath.textureToGrayscale

Function

Converts the texture to a set of 0-255 grayscale values, and outputs the result into outTensor.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

textureToGrayscale(texture, grayscaleBuffer, grayscaleBufferShape): void

Converts the texture to a set of 0-255 grayscale values, and outputs the result into outTensor.

outTensor should be a Uint8Array of shape {width, height, 1}.

Parameters

ParameterType
textureTexture
grayscaleBufferUint8Array
grayscaleBufferShapevec3

Returns

void