Interface ScanModuleExposes User Data

Asset for detecting an object through the Scan system.

//@input Asset.ScanModule scanModule
//@input Asset.Texture someTexture

function scanComplete(json)
{
var obj = JSON.parse(json);
var annotations = obj["annotations"][ScanModule.Contexts.Objects]["annotations"];
if(annotations.length > 0 && annotations[0].confidence > 0.95)
{
print("Scan found: " + annotations[0].name);
}
}

function onFailure(reason)
{
print("Scan failure: " + reason);
}

//if not filled via GUI
script.scanModule.targetTexture = script.someTexture;

script.createEvent("LongPressStartEvent").bind(function() {
script.scanModule.scan([ScanModule.Contexts.Objects], scanComplete, onFailure);
});
interface ScanModule {
    name: string;
    scanTarget: Texture;
    uniqueIdentifier: string;
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
    scan(contexts: string[], scanComplete: ((resultJson: string) => void), scanFailed: ((failureMessage: string) => void)): void;
}

Hierarchy (view full)

Properties

name: string

The name of the Asset in Lens Studio.

scanTarget: Texture

Optional property to pass in a texture for Scan to use.

uniqueIdentifier: string

Methods

  • Returns the name of this object's type.

    Returns string

  • 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

  • Starts a single Scan call using the provided list of ScanModule.Contexts. On success it will invoke scanComplete providing a JSON string. On failure it will invoke onFailure with a failure message passed in as an argument.

    Parameters

    • contexts: string[]
    • scanComplete: ((resultJson: string) => void)
        • (resultJson): void
        • Parameters

          • resultJson: string

          Returns void

    • scanFailed: ((failureMessage: string) => void)
        • (failureMessage): void
        • Parameters

          • failureMessage: string

          Returns void

    Returns void