本文整理汇总了Java中com.google.android.gms.vision.face.FaceDetector.Detections方法的典型用法代码示例。如果您正苦于以下问题:Java FaceDetector.Detections方法的具体用法?Java FaceDetector.Detections怎么用?Java FaceDetector.Detections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.vision.face.FaceDetector
的用法示例。
在下文中一共展示了FaceDetector.Detections方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpdate
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
/**
* Update the position/characteristics of the face within the overlay.
*/
@Override
public void onUpdate(FaceDetector.Detections<Face> detectionResults, Face face) {
mOverlay.add(mFaceGraphic);
boolean isSmiling = face.getIsSmilingProbability() > SMILING_THRESHOLD;
if (isSmiling) {
float leftEye = face.getIsLeftEyeOpenProbability();
float rightEye = face.getIsRightEyeOpenProbability();
if (Math.abs(leftEye - rightEye) >= WINK_THRESHOLD) {
takeShot();
}
}
mFaceGraphic.setIsReady(isSmiling);
mFaceGraphic.updateFace(face);
}
示例2: onUpdate
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
@Override
public void onUpdate(FaceDetector.Detections<Face> detectionResults, final Face face) {
smileProbability = face.getIsSmilingProbability();
if (smileProbability != -1) {
runOnUiThread(new Runnable() {
@Override
public void run() {
setColorAlpha(smileProbability * 255);
}
});
} else {
setColorAlpha(0);
}
}
示例3: onUpdate
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
/**
* Update the position/characteristics of the face within the overlay.
*/
@Override
public void onUpdate(FaceDetector.Detections<Face> detectionResults, Face face) {
mOverlay.add(mFaceGraphic);
mFaceGraphic.updateFace(face);
mFaceGraphic.setSombrero(hatBoolean);
mFaceGraphic.setOjos(eyesBoolean);
mFaceGraphic.setMoustache(moustacheBoolean);
}
示例4: onUpdate
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
/**
* When new frame analysed.
*/
@Override
public void onUpdate(FaceDetector.Detections<Face> detectionResults, Face face) {
Log.d("FaceTracker", "onUpdate" + face.getIsLeftEyeOpenProbability());
//if left and right eyes are open. (Probability more than 10%)
if (face.getIsLeftEyeOpenProbability() > 0.10 && face.getIsRightEyeOpenProbability() > 0.10) {
isEyesClosedCount = 0;
mUserAwareVideoView.onUserAttentionAvailable();
} else {
isEyesClosedCount++;
if (isEyesClosedCount > 2) mUserAwareVideoView.onUserAttentionGone();
}
}
示例5: onUpdate
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
/**
* Update the position/characteristics of the face within the overlay.
*/
@Override
public void onUpdate(FaceDetector.Detections<Face> detectionResults, Face face) {
Log.d(getClass().getSimpleName(), "onUpdate" + face.getIsLeftEyeOpenProbability());
if (face.getIsLeftEyeOpenProbability() > 0.10 && face.getIsRightEyeOpenProbability() > 0.10) {
isEyesClosedCount = 0;
mWakelockManager.acquireWakelock();
} else {
isEyesClosedCount++;
if (isEyesClosedCount > 2) mWakelockManager.releaseWakelock();
}
}
示例6: onUpdate
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
/**
* Updates the positions and state of eyes to the underlying graphic, according to the most
* recent face detection results. The graphic will render the eyes and simulate the motion of
* the iris based upon these changes over time.
*/
@Override
public void onUpdate(FaceDetector.Detections<Face> detectionResults, Face face) {
mOverlay.add(mEyesGraphic);
updatePreviousProportions(face);
PointF leftPosition = getLandmarkPosition(face, Landmark.LEFT_EYE);
PointF rightPosition = getLandmarkPosition(face, Landmark.RIGHT_EYE);
float leftOpenScore = face.getIsLeftEyeOpenProbability();
boolean isLeftOpen;
if (leftOpenScore == Face.UNCOMPUTED_PROBABILITY) {
isLeftOpen = mPreviousIsLeftOpen;
} else {
isLeftOpen = (leftOpenScore > EYE_CLOSED_THRESHOLD);
mPreviousIsLeftOpen = isLeftOpen;
}
float rightOpenScore = face.getIsRightEyeOpenProbability();
boolean isRightOpen;
if (rightOpenScore == Face.UNCOMPUTED_PROBABILITY) {
isRightOpen = mPreviousIsRightOpen;
} else {
isRightOpen = (rightOpenScore > EYE_CLOSED_THRESHOLD);
mPreviousIsRightOpen = isRightOpen;
}
mEyesGraphic.updateEyes(leftPosition, isLeftOpen, rightPosition, isRightOpen);
}
示例7: onUpdate
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
/**
* Update the position/characteristics of the face within the overlay.
*/
@Override
public void onUpdate(FaceDetector.Detections<Face> detectionResults, Face face) {
mOverlay.add(mFaceGraphic);
mFaceGraphic.updateFace(face);
mFace = face;
}
示例8: onUpdate
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
/**
* Update the position/characteristics of the face within the overlay.
*/
@Override
public void onUpdate(FaceDetector.Detections<Face> detectionResults, Face face) {
mOverlay.add(mFaceGraphic);
mFaceGraphic.updateFace(face);
}
示例9: onMissing
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
/**
* Hide the graphic when the corresponding face was not detected. This can happen for
* intermediate frames temporarily (e.g., if the face was momentarily blocked from
* view).
*/
@Override
public void onMissing(FaceDetector.Detections<Face> detectionResults) {
mFaceGraphic.goneFace();
mOverlay.remove(mFaceGraphic);
}
示例10: onUpdate
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
@Override public void onUpdate(FaceDetector.Detections<Face> detectionResults, Face face) {
faceGraphic.updateFace(face);
graphicOverlay.update(this);
}
示例11: onMissing
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
@Override public void onMissing(FaceDetector.Detections<Face> detectionResults) {
graphicOverlay.forget(this);
faceGraphic.forgetFace();
}
示例12: onMissing
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
/**
* Hide the graphic when the corresponding face was not detected. This can happen for
* intermediate frames temporarily (e.g., if the face was momentarily blocked from
* view).
*/
@Override
public void onMissing(FaceDetector.Detections<Face> detectionResults) {
mOverlay.remove(mFaceGraphic);
}
示例13: onMissing
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
/**
* Hide the graphic when the corresponding face was not detected. This can happen for
* intermediate frames temporarily (e.g., if the face was momentarily blocked from
* view).
*/
@Override
public void onMissing(FaceDetector.Detections<Face> detectionResults) {
Log.d("onMissing","" );
}
示例14: onMissing
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
/**
* Hide the graphic when the corresponding face was not detected. This can happen for
* intermediate frames temporarily (e.g., if the face was momentarily blocked from
* view).
*/
@Override
public void onMissing(FaceDetector.Detections<Face> detectionResults) {
}
示例15: onMissing
import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
/**
* Hide the graphic when the corresponding face was not detected. This can happen for
* intermediate frames temporarily (e.g., if the face was momentarily blocked from
* view).
*/
@Override
public void onMissing(FaceDetector.Detections<Face> detectionResults) {
mOverlay.remove(mEyesGraphic);
}