新しい image target を作成する | POST /targets
recognition image を upload し、新しい image target を作成します。
Action
POST /targets
Authentication
Http Header
Content-Type=application/json
HTTP Header: Authorization (API Key Token authentication を使用する場合)
Request parameters
| Field | Type | Required | Description |
|---|---|---|---|
| image | String(base64) | Yes | image content の base64 encoded string。JPG および PNG format images をサポートします。image 最大 2MB。 |
| active | String | No | "1" は target を enable、"0" は target を disable することを示します。default は "1"。 |
| name | String | Yes | Target name。英字、英文 punctuation、数字のみサポートします。長さは最小 1 文字、最大 64 文字。 |
| size | String (Float) | Yes | recognition image の幅 (unit: cm)。recognition image の高さは、upload した image に基づいてシステムが自動計算します。recognition image のサイズは virtual content のサイズに対応します。default 20。 |
| meta | String | Yes | 通常、AR content information を text string format で保存するために使用します。default は ""。例: 認識対象の JSON information、image の base64 encoding、または cloud storage 内の大容量ファイルの URL download address。最大 2MB。 |
| type | String (Float) | Yes | string "ImageTarget" として固定設定する必要があります。大文字小文字は完全に一致する必要があります。 |
| allowSimilar | String | No | similar image が存在する場合に強制的に追加を許可するかどうか。default は 0。similar images は recognition results に影響する可能性があるため、default を推奨します。 |
注記
- image 最大制限: 2MB
- meta 最大制限: 2MB
Request example
POST /targets/ HTTP/1.1
Host:
Date: Mon, 1 Jan 2018 00:00:00 GMT
Content-Type: application/json
{
"image":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgM...",
"active":"1",
"name":"easyar",
"size":"5",
"meta":"496fbbabc2b38ecs3460a...",
"type":"ImageTarget",
"timestamp": 1514736000000,
"appKey": "test_app_key",
"signature": "89985e2420899196db5bdf16b3c2ed0922c0c221"
}
Response example
HTTP/1.1 200 OK
Content-Type: application/json
{
"statusCode": 0,
"result": {
"target": {
"targetId":"e61db301-e80f-4025-b822-9a00eb48d8d2",
"trackingImage":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgM...",
"name": "easyar",
"size": "5",
"meta": "496fbbabc2b38ecs3460a...",
"type": "ImageTarget",
"modified":1514735000000
"active":"1",
"trackableRate": 0,
"detectableRate": 0,
"detectableDistinctiveness":0,
"detectableFeatureCount", 0,
"trackableDistinctiveness", 0,
"trackableFeatureCount", 0,
"trackableFeatureDistribution", 0,
"trackablePatchContrast", 0,
"trackablePatchAmbiguity", 0
}
},
"timestamp": 1514736000000
}
Response fields
| Field | Description |
|---|---|
| statusCode | Status code。0 は authentication が正しいことを示します。詳細は Status codes を参照してください |
| result | Error message または target image information |
| timestamp | response が返されたときの server-side time。Unix timestamp format を使用し、単位は millisecond |
| result.targetId | target image の unique ID |
| result.trackingImage | tracking image の base64 encoded string |
| result.name | Target name |
| result.size | recognition image の幅 (unit: cm)。recognition image の高さは upload した image に基づいてシステムが自動計算します。recognition image のサイズは重ね合わせる virtual content のサイズに対応します |
| result.meta | base64 encoded additional information。たとえば json string を base64 encoding して生成した string |
| result.type | Fixed as ImageTarget |
| result.active | "1" enabled、"0" disabled |
Error codes
Status codes と error codes の一覧 を参照してください
Meta 使用説明
- Video URL を関連付ける
- 各 recognition target について、その特定 target に関連付けられた video URL を meta field に保存できます
- アプリケーションが target を認識した後、meta 内の URL を使用して server に接続し、video を download して再生します。例:
https://my_server/my_videos/my_video_001.mp4
- 3D model を関連付ける
- 各 recognition target について、その特定 target に関連付ける 3D model または Unity asset bundle を含む meta field を保存できます
- model を base64 encoding して meta に保存するか、metadata に model の URL を保存する必要があります
- アプリケーションが target を認識した後、detected target 上に 3D model を rendering します