Vuforia是個強大的AR平台。使用Vuforia API 可以實現物體識別,圖片追蹤,柱型追蹤,多對象追蹤,自定義目標追蹤,雲識別,文字識別,幀標識和虛擬按鈕等功能。
它支持Android, iOS, Unity等多個環境的開發。Vuforia有免費版的,並且適合初學者上手。已經有22萬的程序員使用Vuforia進行AR編程,不過目前沒有中文版的API.
Vuforia的安裝
1.下載Vuforia SDK (~7M)
https://developer.vuforia.com/downloads/sdk 找到Android版下載
百度雲下載 http://pan.baidu.com/s/1pL2CAZx
提取碼 ckdx
2. 解壓並放在Android sdk文件夾的目錄下
3. 下載示例,解壓后放到samples文件夾內 (~26M)
https://developer.vuforia.com/downloads/sdk
百度雲下載 http://pan.baidu.com/s/1qX7KapY
提取碼 r5cj
4.運行實例代碼 學習使用Vuforia SDK 核心功能 打開Android Studio 選擇打開Android Studio 項目導入實例
5 導入項目后 Gadle可能會構建失敗, 解決的方法如下:
1.把build.gradle中的gradle版本改成你的Android Studio中的版本
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
2. 在gradle-wrapper.properties修改
3. 把app -> build.gradle 中的 compileSdkVersion, buildToolsVersion, targetSdkVersion改成你的Android Studio中使用的版本
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
4. launching app 報錯
“The currently selected variant "debug" uses split APKs, but none of the 1 split apks are compatible with the current device with density "420" and ABIs "x86".
Error while Installing APK”
這些例子不支持“x86"的CPU, 可以新建一個模擬器,選擇”armeabi-v7a“版本的API, 但這樣有可能會非常的慢,最好用真機測試。
5. "Vuforia App key is missing. Please get a valid key, by logging into your account at developer.vuforia.com and creating a new project"
Vuforia 4.0 以上要求一個License key. 在官網上注冊一個賬號,在develop->License Manager 下按步驟填寫就能得到一個license key.
復制粘貼到SampleApplicationSession.java 中的 InitVuforiaTask類中的Vuforia.setInitParameter(mActivity,mVuforiaFlags,"把license key 放這里") 中的第三個參數中。 重新運行就可以了。