Class BodyInstanceSegmentationTextureProvider

Provides segmentation confidence values encoded in the R channel. The texture has the Colorspace#RGBA format in screen resolution, but G, B, A channels should be ignored.

// @input Component.Image image

// Get the Body Instance Segmentation Texture from passed in Image component
const bodySegmentationTexture = script.image.mainPass.baseTex;

// Get the provider of the texture
const segmentationTextureProvider = bodySegmentationTexture.control;

// On tap, switch betweeen first and second body to segment
script.createEvent("TapEvent").bind(function() {
const isTrackingBodyZero = segmentationTextureProvider.bodyIndex === 0;
const bodyToSegment = isTrackingBodyZero ? 1 : 0;
segmentationTextureProvider.bodyIndex = bodyToSegment;

print("Segmenting body: " + bodyToSegment);
})

Hierarchy (View Summary, Expand)

Constructors

Properties

bodyIndex: number

Which body to segment if multiple are available.

refineEdge: boolean

Methods

  • Returns the texture's aspect ratio, which is calculated as width / height.

    Returns number

  • Returns the width of the texture in pixels.

    Returns number

  • Returns true if the object matches or derives from the passed in type.

    Parameters

    • type: string

    Returns boolean

  • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean

MMNEPVFCICPMFPCPTTAAATR