UnityAR Vuforia(高通)3D物体识别(ObjectTarget)
引擎版本须知
Unity2020.3.5f1c1
UnityAndroid的Project Settings–>Player–>
- Minimum API Level:Android 6.0(API Level 23)
- Target API Level:Android 11.0(API Level 30)
该设置是经过测试之后,插件需求的相应设置。 
Vuforia Engine 9.8
项目开发时,Vuforia Engine已经发布的最新版本为10.10。经过测试最新版本将ObjectTarget弃用,在新版本插件中已无法使用,故使用旧版本9.8:Vuforia Engine官网。
Vuforia 引擎 9.8 不再受支持,其相关库内容将移至此库存档。 
插件导入及更新
Vuforia引擎可用作一个引擎,可以从菜单Assets -> Import Package -> Custom Package导入到Unity项目中。导入包将允许脚本在Unity项目中进行必要的更改,以安装或升级到最新的Vuforia引擎SDK(.unitypackage)。
将 Vuforia 引擎添加或更新到您的 Unity 项目 (SDK 下载)
该软件包会自动将最新的 Vuforia 引擎版本添加到您的 Unity 项目中。  要手动检查是否有新的更新可用,请转到Help -> Vuforia Engine -> Check for Updates: 
3D物体数据扫描
需要在安卓手机上安装一个Vuforia Object Scanner应用,用于3D物体的数据扫描。  划到页面最下端。  下载的压缩包中不止有程序的apk文件,还有两张.pdf文件,这就是扫描物体时所必须要用的扫描基准图,需要将物体放到其图纸之上,故需要自己打印。   数据线连接手机,将apk文件拷入手机安装。如图,  好了,接下来就是扫描三维物体。 将盒子放到纸上的灰色部分,它上面有个坐标系,盒子大致位置放好就可以。  点击手机上安装好的Scanner。   对准盒子会出现:  三条线就是高通做的一个坐标系,点击红色录像按钮。即可看到盒子上有很多绿色的识别点,识别点越多,越容易比识别,还有一个有线框的遮罩,转动纸,使手机能够一圈扫描盒子,扫描识别到后,遮罩就会编程绿色,尽可能多识别点。 注意:识别的目标尽可能大点,我之前用笔测试,虽然识别点很多,但是测试还是很难识别;还有就是转动纸,尽可能从各个方向识别,做多个识别点。 另外,物体的识别难易程度和颜色深浅没有关系,但和物体上的简易程度有关系,越复杂就越容易被识别,例如:我用一张写满字的纸张比一个有几个对比鲜明色彩的纸张更容易识别。 还有就是不要用圆形的东西,例如杯子,我测试了好几个圆形的东西,都不太容易识别。 识别完成之后,点击对勾,取个名字100cocoa,保存之后。  点击Test,将盒子从A4纸上拿下来,扫描盒子,即可看到盒子的原点。  好了,测试成功,点击上传到电脑上。  使用交流软件发送导入电脑之后是一个.od文件。  好了,此处扫描三维物体的步骤就完成了,接下来和之前的上传图片类似,将该.od文件上传到高通官网。  首先创建Database。(名称根据自己需求随便取)  创建好后添加数据(Add Target)。   将刚才上传的100cocoa.od文件上传即可创建完成;创建好下载就是UnityPackage文件。  导入Unity中: 
Unity场景设置
Unity创建新场景,创建Vuforia高通插件中的ARCamera和ObjectTarget,并删除原场景的MainCamera。   在ARCamera下的Vuforia Behaviour中添加许可证书。   许可证书的申请在官网中,在License Manager中得到License Key,如下图:  将密钥复制到Unity的App License Key中。 选择ObjectTarget–>Inspector界面进行设置。  在图片下新建一个物体,用于测试。  好了。保存场景,打包运行测试。## 插件&APK下载链接 我这里保存了一个我使用的版本,以备之后官网版本更新带来的风险:https://download.csdn.net/download/f_957995490/86819483
参考链接
- https://library.vuforia.com/getting-started/getting-started-vuforia-engine-unity#print
- https://blog.csdn.net/qq_42345116/article/details/123819408
- https://blog.csdn.net/weixin_43541308/article/details/121790959
- https://blog.csdn.net/weixin_37608784/article/details/80434554
|