【发布时间】:2016-07-20 04:37:27
【问题描述】:
我正在使用来自mobile vision API 的getIsLeftEyeOpenProbability 来了解眼睛是否睁开。但是,发生了一些奇怪的事情,即使睁开眼睛,我总是得到-1 的概率。
代码如下:
FaceDetector faceDetector = new FaceDetector.Builder(getApplicationContext())
.setTrackingEnabled(false)
.setLandmarkType(FaceDetector.ALL_LANDMARKS)
.build();
Frame frame = new Frame.Builder().setBitmap(obtainedBitmap).build();
SparseArray < Face > facesForLandmarks = faceDetector.detect(frame);
faceDetector.release();
Thread homeSwipeThread;
for (int a = 0; a < facesForLandmarks.size(); a++) {
Face thisFace = facesForLandmarks.valueAt(a);
List < Landmark > landmarks = thisFace.getLandmarks();
for (int b = 0; b < landmarks.size(); b++) {
if (landmarks.get(b).getType() == landmarks.get(b).LEFT_EYE) {
leftEye = new Point(landmarks.get(b).getPosition().x, landmarks.get(b).getPosition().y - 3);
} else if (landmarks.get(b).getType() == landmarks.get(b).RIGHT_EYE) {
rightEye = new Point(landmarks.get(b).getPosition().x, landmarks.get(b).getPosition().y - 3);
} //end else if.
} //end inner
//for every detected face check eyes probability:
if (thisFace.getIsLeftEyeOpenProbability() <= 0.1) {
//some code
}
}
为什么会发生这种情况,我该如何解决?
【问题讨论】:
标签: android computer-vision android-camera android-vision eye-detection