標籤:
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 放這裡") 中的第三個參數中。 重新運行就可以了。
【AR】增強現實安卓編程 - Vuforia SDK 的安裝和使用 (Android Studio)