android – 为什么某些设备上没有新的Play-Services FaceDetector?

android – 为什么某些设备上没有新的Play-Services FaceDetector?,第1张

概述背景 谷歌几个月前发布了一个新的API来检测位图上的面孔: > http://android-developers.blogspot.co.il/2015/08/face-detection-in-google-play-services.html > https://developers.google.com/vision/introduction#apis > https://develope 背景

谷歌几个月前发布了一个新的API来检测位图上的面孔:

> http://android-developers.blogspot.co.il/2015/08/face-detection-in-google-play-services.html
> https://developers.google.com/vision/introduction#apis
> https://developers.google.com/vision/face-detection-concepts#face_orientation
> https://search-codelabs.appspot.com/codelabs/face-detection#1
> https://github.com/googlesamples/android-vision

它应该比built-in FaceDetector class更快更好,并且与它相比没有任何限制/限制(就像输入位图与配置565的需要,位图宽度是偶数,并且有最大面检测).

代码也非常简单:

表现:

<Meta-data     androID:name="com.Google.androID.gms.vision.DEPENDENCIES"     androID:value="face" />

Java的:

FaceDetector faceDetector = new       FaceDetector.Builder(getApplicationContext()).setTrackingEnabled(false).build();if(!faceDetector.isOperational()){   //show error  return;  }Frame frame = new Frame.Builder().setBitmap(myBitmap).build();SparseArray<Face> faces = faceDetector.detect(frame);

问题

似乎API在某些设备上不可用,在调用“isOperational()”时返回“false”.

>在Nexus 4(AndroID 4.4.4)和Nexus 5(AndroID 6.0.1)上,它根本不起作用
>在Nexus 5x(AndroID 6.0.1)和galaxy S4(AndroID 5.0)上运行正常
>在LG G2(AndroID 4.2.2)上,它仅适用于第二轮样本.

我发现了什么

我找到了一些线索:

>在Github(here),其他人也发现了这个问题.
>样本says(在“Photo-demo”中,在“PhotoVIEwerActivity.java”文件中)该库可能不可用,但如果不是,它将被下载:

if (!safeDetector.isOperational()) {    // Note: The first time that an app using face API is installed on a device,GMS will    // download a native library to the device in order to do detection.  Usually this    // completes before the app is run for the first time.  But if that download has not yet    // completed,then the above call will not detect any faces.    //    // isOperational() can be used to check if the required native library is currently    // available.  The detector will automatically become operational once the library    // download completes on device.    Log.w(TAG,"Face detector dependencIEs are not yet available.");    // Check for low storage.  If there is low storage,the native library will not be    // downloaded,so detection will not become operational.    IntentFilter lowstorageFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);    boolean hasLowStorage = registerReceiver(null,lowstorageFilter) != null;    if (hasLowStorage) {        Toast.makeText(this,R.string.low_storage_error,Toast.LENGTH_LONG).show();        Log.w(TAG,getString(R.string.low_storage_error));    }}

我试图重置播放服务应用程序(这样可能会强制重新下载库),但它似乎不起作用(在Nexus 5上试过).

这个问题

>有没有办法强制下载库,然后开始使用API​​?这个 *** 作有听众吗?
>使用“isOperational”会触发此下载吗?
>为什么某些Nexus设备无法使用?我在这里错过了一些我应该知道的关于使用这个库的东西吗?
>我发现,输入真的没有限制/限制吗?我注意到有人报告了内存问题(here).使用try-catch(OutOfMemoryError)有助于处理OOM吗?

解决方法 关于它为什么在某些设备上不起作用,Google answered it:

There is a kNown issue with the new version of GMscore (v9) that was
just released today. From the release notes:

A service required by Mobile Vision is Now Disabled due to a serIoUs
BUG in that service. This will prevent users who have not already used
face or barcode detection from using those features. We do not
recommend adding new Mobile Vision features to your app until this
issue is fixed. For apps that already use Mobile Vision features,check FaceDetector.isOperational() or barcodeDetector.isOperational() to confirm detector readiness before using the face or barcode detector.
总结

以上是内存溢出为你收集整理的android – 为什么某些设备上没有新的Play-Services FaceDetector?全部内容,希望文章能够帮你解决android – 为什么某些设备上没有新的Play-Services FaceDetector?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1123793.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存