새 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 image 를 지원합니다. image 최대 2MB. |
| active | String | No | "1" 은 target enable, "0" 은 target disable 을 의미합니다. default 는 "1". |
| name | String | Yes | Target name. English letters, English punctuation, digits 만 지원합니다. 길이는 최소 1 character, 최대 64 characters. |
| size | String (Float) | Yes | recognition image width(unit: cm). recognition image height 는 upload 한 image 에 따라 system 이 자동 계산합니다. recognition image 의 size 는 virtual content 의 size 와 대응됩니다. default 20. |
| meta | String | Yes | 일반적으로 AR content information 을 text string format 으로 저장하는 데 사용됩니다. default 는 "". 예: recognized object 의 JSON information, image 의 base64 encoding, 또는 cloud storage 에 있는 대용량 file 의 URL download address. 최대 2MB. |
| type | String (Float) | Yes | 반드시 string "ImageTarget" 으로 fixed configuration 해야 합니다. 대소문자가 완전히 같아야 합니다. |
| 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 을 사용하며 단위는 milliseconds |
| result.targetId | target image 의 unique ID |
| result.trackingImage | tracking image 의 base64 encoded string |
| result.name | Target name |
| result.size | recognition image width(unit: cm). recognition image height 는 upload 한 image 에 따라 system 이 자동 계산합니다. recognition image 의 size 는 overlay virtual content 의 size 와 대응됩니다 |
| 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 에 저장할 수 있습니다
- application 이 target 을 인식한 후 meta 의 URL 을 사용하여 server 에 connect 하고 video 를 download 및 play 합니다. 예:
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 을 저장해야 합니다
- application 이 target 을 인식하면 detected target 위에 3D model 을 rendering 합니다