生成目标
在本节中,您将使用先前创建的模型 .pvz 文件生成目标;这些目标可在多个体验中复用。在本例中,我们将使用标准模型目标,以便您更快地完成用例,但如果您愿意,可以随时使用功能更强大的高级模型目标或本地高级模型目标。
在大多数情况下,请求结构依赖于 Vuforia Engine SDK API 定义。有关 Studio 的具体指引,请参阅 Experience ServiceAPI 文档
1. 请确保配置的视图考虑了模型目标的大小和方向。至少应创建一个使模型从明显且易于识别的角度完全可见的视图,以优化检测和追踪性能。使用以下方法之一,在 API 中生成目标:
方法
操作说明
在 Postman 中
POST /ExperienceService/products/v1/target
{
"name": "Quadcopter Base",
"targetType": "standard",
"targetSdk": "10.9",
"models": [
{
"name": "Quadcopter Base SMT",
"modelId": <Model-Id>, //take the UUID that the Post Model API returned in the last step
"optimizeTrackingFor": "LOW_FEATURE_OBJECTS",
"automaticColoring": "auto",
"upVector": [0.0, 1.0, 0.0],
"views": [
{
"name": "viewpoint_0000",
"layout": "landscape",
"guideViewPosition": {
"translation": [0.19104722142219543,
0.19300971925258636,
0.2014508694410324],
"rotation": [-0.23911770032491195,
0.36964383294987413,
0.09904579601423466,
0.892399065690545]
}
}
]
}
]
}
使用 Curl 命令
curl --location 'https://<yourESURL>/ExperienceService/products/v1/target' \
--header 'X-Requested-With: any' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"name": "quadcopter base",
"targetType": "standard",
"targetSdk": "10.9",
"models": [
{
"name": "Quadcopter Base SMT",
"modelId": "yourModelUUID",
"optimizeTrackingFor": "LOW_FEATURE_OBJECTS",
"automaticColoring": "auto",
"upVector": [0.0,1.0,0.0],
"views": [
{
"name": "viewpoint_0000",
"layout": "landscape",
"guideViewPosition": {
"translation": [0.19104722142219543,
0.19300971925258636,
0.2014508694410324],
"rotation": [-0.23911770032491195,
0.36964383294987413,
0.09904579601423466,
0.892399065690545]
}
}
]
}
]
}
'
2. 响应类似于以下内容:
{
"targetId": "<targetId>", // Optional. Only sent in case when job to create Target is accepted.
}
3. 使用以下方法之一,获取模型目标生成的状况:
方法
操作说明
在 Postman 中
GET /ExperienceService/products/v1/target/status/<targetId>
使用 Curl 命令
curl --location 'http://<yourESURL>/ExperienceService/products/v1/target/status/<yourTargetUUID>' \
--header 'Authorization: ••••••'
4. 响应类似于以下内容:
{
"simplifiedStatus": "queued|inProgress|completed|failed|deleted|toBeCancelled|toBeDeleted", // Dataset's current status

}
5. 重复步骤 1-4,为 Quadcopter Updated 模型生成标准模型目标。请确保更新请求中的 modelId
6. 现在,必要的资产已经创建完毕,我们将继续下一章节,开始将数据逻辑构建到体验中
这对您有帮助吗?