0
我正在創建人臉檢測應用程序。當我嘗試啓動人臉檢測,我得到以下錯誤:嘗試啓動人臉檢測時訪問ByteBuffer時出錯
E/NativeFaceDetectorImpl: Native face detection failed
E/NativeFaceDetectorImpl: java.lang.RuntimeException: Error accessing ByteBuffer.
這裏是我的代碼部分:
Context context = getApplicationContext();
FaceDetector detector = new FaceDetector.Builder(context)
.setClassificationType(FaceDetector.ALL_CLASSIFICATIONS)
.setMode(FaceDetector.ACCURATE_MODE)
.build();
detector.setProcessor(
new MultiProcessor.Builder<>(new FaceTrackerFactory())
.build());
if (!detector.isOperational()) {
Log.w(TAG, "Face detector dependencies are not yet available.");
}
mCameraSource = new CameraSource.Builder(context, detector)
.setFacing(CameraSource.CAMERA_FACING_BACK)
.setRequestedFps(30.0f)
.build();
顯示錯誤,當我做mCameraSource.start(),即使這樣做時沒有檢測到錯誤,應用程序不會崩潰,它只是在控制檯上反覆顯示該錯誤。
您使用的是Android和Google Play服務的哪個版本?我似乎記得在使用Gingerbread和Google Play Services 7.8時存在這樣的問題。如果這是同一個問題,那麼如果您使用Google Play Services 8.1,則應該修復此問題。 – pm0733464
我正在使用Google Play服務版本8.1並針對Android API 19編譯,所以我想這不是問題:/ –