Ir al contenido principal

Objetivos de imagen

La nueva API permite definir objetivos de imagen directamente desde el código como XrController.configure({imageTargetData: [{...}]}).

Objetivo de imagen plana

Si está configurando un nuevo objetivo de imagen plana:

  1. Empieza convirtiendo la imagen a escala de grises y recortándola/escalándola/rotándola a 480x640 píxeles.
  2. Defina los datos de destino de la imagen:
const imageTarget = {
"imagePath": "./path/to/image.png",
"metadata": {}, // available for custom use cases
"name": "my-image-target",
"type": "PLANAR",
"xrMetadata": {
"left": 0,
"top": 0,
"width": 480,
"height": 640,
"originalWidth": 480,
"originalHeight": 640,
"isRotated": false, // set this to true if you rotated the image when you cropped it
}
}

Objetivo de imagen cilíndrica

Para los objetivos cilíndricos, hay más parámetros que proporcionar (cylinderSideLength, cylinderCircumferenceTop, targetCircumferenceTop, cylinderCircumferenceBottom, arcAngle, coniness).

  1. Defina los datos de destino de la imagen:
const imageTarget = {
"imagePath": "./path/to/image.png",
"metadata": {}, // available for custom use cases
"name": "my-image-target",
"type": "CYLINDER",
"xrMetadata": {
"left": 0,
"top": 18,
"width": 1476,
"height": 1968,
"originalWidth": 1476,
"originalHeight": 2000,
"isRotated": false, // set this to true if you rotated the image when you cropped it
"cylinderSideLength": 135.5,
"cylinderCircumferenceTop": 257.14, // This should match circumferencce bottom
"targetCircumferenceTop": 100,
"cylinderCircumferenceBottom": 257.14,
"arcAngle": 140.0,
"coniness": 0, // This should be 0 for all cylinders
"inputMode": "BASIC",
"unit": "mm",
}
}

Objetivo de imagen cónica

Para los objetivos cónicos, existe la unconificación, además de que el formato de entrada es diferente al que se subió a la web.

  1. Empieza con una imagen arco iris recortada por los radios superior (línea verde punteada) e inferior (línea verde en negrita).

  1. Estirar la imagen del arco iris para que sea plana, y recortar/escalar/rotar las dimensiones de la imagen plana, no convertida, para que sea una escala de grises de 480x640 píxeles (esta imagen recortada debe ser la imagen proporcionada en la ruta de la imagen).
  2. Defina los datos de destino de la imagen:
const imageTarget = {
"imagePath": "./path/to/image.png", // path to unconified image
"metadata": {}, // available for custom use cases
"name": "my-image-target",
"type": "CONICAL",
"xrMetadata": {
"left": 177,
"top": 554,
"width": 564,
"height": 752,
"originalWidth": 842,
"originalHeight": 2000,
"isRotated": false, // set this to true if you rotated the image when you cropped it
"topRadius": 4479,
"bottomRadius": 3630.644,
"cylinderSideLength": 21.05,
"cylinderCircumferenceTop": 100,
"targetCircumferenceTop": 50,
"cylinderCircumferenceBottom": 81.06,
"arcAngle": 180,
"coniness": 0.303, // log2(topRadius / bottomRadius)
"inputMode": "BASIC",
"unit": "mm",
}
}