本文へスキップ

イメージターゲット

新しいAPIでは、イメージターゲットをコードから直接XrController.configure({imageTargetData: [{...}]})として定義することができます。

フラット・イメージ・ターゲット

新しいフラット・イメージ・ターゲットを設定する場合:

  1. まず画像をグレースケールに変換し、480x640ピクセルにトリミング/拡大/回転する。
  2. イメージターゲットデータを定義する:
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
}
}

円筒イメージターゲット

円筒形のターゲットの場合、指定するパラメータが増えます(cylinderSideLength, cylinderCircumferenceTop, targetCircumferenceTop, cylinderCircumferenceBottom, arcAngle, coniness )。

  1. イメージターゲットデータを定義する:
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",
}
}

円錐イメージターゲット

円錐ターゲットの場合、アンシフィケーションがあり、さらに入力フォーマットがウェブにアップロードされたものとは異なる。

  1. 上(緑の点線)と下(緑の太線)の半径で切り取った虹の画像から始めます。

  1. 虹の画像を平坦になるように引き伸ばし、その平坦な画像を480x640ピクセルのグレースケールになるようにトリミング/拡大縮小/回転する(このトリミング画像は、画像パスで提供された画像でなければなりません)。
  2. イメージターゲットデータを定義する:
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",
}
}