Skip to main content

Image Target Events

Types

ImagePropertiesObject

ImagePropertiesObject is an object with the following properties:

PropertyTypeDescription
widthNumberWidth of the image target.
heightNumberHeight of the image target.
originalWidthNumberWidth of the uploaded image.
originalHeightNumberHeight of the uploaded image.
isRotatedbooleanWhether the image target has been rotated.

ImageLoadingObject

ImageLoadingObject is an object with the following properties:

PropertyTypeDescription
nameStringThe image's name.
typeStringOne of FLAT, CYLINDRICAL, CONICAL.
metadataObjectUser metadata.

ImageScanningObject

ImageScanningObject is an object with the following properties:

PropertyTypeDescription
nameStringThe image's name.
typeStringOne of FLAT, CYLINDRICAL, CONICAL.
metadataObjectUser metadata.
geometryObjectObject containing geometry data. If type=FLAT: {scaledWidth, scaledHeight}, else if type=CYLINDRICAL or type=CONICAL: {height, radiusTop, radiusBottom, arcStartRadians, arcLengthRadians}

Events

REALITY_IMAGE_FOUND

This event is emitted when an image target is first found.

Properties

PropertyTypeDescription
nameStringThe image's name.
typeStringOne of FLAT, CYLINDRICAL, CONICAL.
position{x, y, z}The 3d position of the located image.
rotation{w, x, y, z}The 3d local orientation of the located image.
scaleNumberA scale factor that should be applied to object attached to this image.
propertiesImagePropertiesObjectAdditional image target properties.
scaledWidthNumberOnly applicable to FLAT. The width of the image in the scene, when multiplied by scale.
scaledHeightNumberOnly applicable to FLAT. The height of the image in the scene, when multiplied by scale.
heightNumberOnly applicable to CYLINDRICAL or CONICAL. Height of the curved target.
radiusTopNumberOnly applicable to CYLINDRICAL or CONICAL. Radius of the curved target at the top.
radiusBottomNumberOnly applicable to CYLINDRICAL or CONICAL. Radius of the curved target at the bottom.
arcStartRadiansNumberOnly applicable to CYLINDRICAL or CONICAL. Starting angle in radians.
arcLengthRadiansNumberOnly applicable to CYLINDRICAL or CONICAL. Central angle in radians.

Example

defineState('initial-state').initial().listen(world.events.globalId, ecs.events.REALITY_IMAGE_FOUND, (event) => {
console.log('Image found: ', event.data.name)
})

REALITY_IMAGE_LOADING

This event is emitted when detection image loading begins.

Properties

PropertyTypeDescription
imageTargetsArray<ImageLoadingObject>The list of image targets.

Example

defineState('initial-state').initial().listen(world.events.globalId, ecs.events.REALITY_IMAGE_LOADING, (event) => {
event.data.imageTargets.forEach(({name, type, metadata, geometry}) => {
console.log('Loading: ', name)
})
})

REALITY_IMAGE_LOST

This event is emitted when an image target is no longer being tracked.

Properties

PropertyTypeDescription
nameStringThe image's name.
typeStringOne of FLAT, CYLINDRICAL, CONICAL.
position{x, y, z}The 3d position of the located image.
rotation{w, x, y, z}The 3d local orientation of the located image.
scaleNumberA scale factor that should be applied to object attached to this image.
propertiesImagePropertiesObjectAdditional image target properties.
scaledWidthNumberOnly applicable to FLAT. The width of the image in the scene, when multiplied by scale.
scaledHeightNumberOnly applicable to FLAT. The height of the image in the scene, when multiplied by scale.
heightNumberOnly applicable to CYLINDRICAL or CONICAL. Height of the curved target.
radiusTopNumberOnly applicable to CYLINDRICAL or CONICAL. Radius of the curved target at the top.
radiusBottomNumberOnly applicable to CYLINDRICAL or CONICAL. Radius of the curved target at the bottom.
arcStartRadiansNumberOnly applicable to CYLINDRICAL or CONICAL. Starting angle in radians.
arcLengthRadiansNumberOnly applicable to CYLINDRICAL or CONICAL. Central angle in radians.

Example

defineState('initial-state').initial().listen(world.events.globalId, ecs.events.REALITY_IMAGE_LOST, (event) => {
console.log('Image lost: ', event.data.name)
})

REALITY_IMAGE_SCANNING

This event is emitted when all detection images have been loaded and scanning has begun.

Properties

PropertyTypeDescription
imageTargetsArray<ImageScanningObject>The list of image targets.

Example

defineState('initial-state').initial().listen(world.events.globalId, ecs.events.REALITY_IMAGE_SCANNING, (event) => {
event.data.imageTargets.forEach(({name, type, metadata, geometry}) => {
console.log('Scanning: ', name)
})
})

REALITY_IMAGE_UPDATED

This event is emitted when an image target changes position, rotation or scale.

Properties

PropertyTypeDescription
nameStringThe image's name.
typeStringOne of FLAT, CYLINDRICAL, CONICAL.
position{x, y, z}The 3d position of the located image.
rotation{w, x, y, z}The 3d local orientation of the located image.
scaleNumberA scale factor that should be applied to object attached to this image.
propertiesImagePropertiesObjectAdditional image target properties.
scaledWidthNumberOnly applicable to FLAT. The width of the image in the scene, when multiplied by scale.
scaledHeightNumberOnly applicable to FLAT. The height of the image in the scene, when multiplied by scale.
heightNumberOnly applicable to CYLINDRICAL or CONICAL. Height of the curved target.
radiusTopNumberOnly applicable to CYLINDRICAL or CONICAL. Radius of the curved target at the top.
radiusBottomNumberOnly applicable to CYLINDRICAL or CONICAL. Radius of the curved target at the bottom.
arcStartRadiansNumberOnly applicable to CYLINDRICAL or CONICAL. Starting angle in radians.
arcLengthRadiansNumberOnly applicable to CYLINDRICAL or CONICAL. Central angle in radians.

Example

defineState('initial-state').initial().listen(world.events.globalId, ecs.events.REALITY_IMAGE_UPDATED, (event) => {
console.log('Image updated: ', event.data.position, event.data.rotation)
})