当前位置: 首页>>代码示例>>Java>>正文


Java FaceDetector.Detections方法代码示例

本文整理汇总了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);
}
 
开发者ID:nesterov-n,项目名称:Smiley,代码行数:19,代码来源:FaceTrackerActivity.java

示例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);
    }
}
 
开发者ID:paolorotolo,项目名称:happily,代码行数:15,代码来源:MainActivity.java

示例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);
}
 
开发者ID:VideonaTalentum,项目名称:ProyectoAndroid,代码行数:12,代码来源:Presenter.java

示例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();
    }
}
 
开发者ID:kevalpatel2106,项目名称:UserAwareVideoView,代码行数:17,代码来源:FaceAnalyser.java

示例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();
    }
}
 
开发者ID:kevalpatel2106,项目名称:Prevent-Screen-Off,代码行数:18,代码来源:FaceAnalyser.java

示例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);
}
 
开发者ID:googlesamples,项目名称:android-vision,代码行数:35,代码来源:GooglyFaceTracker.java

示例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;
}
 
开发者ID:raptox,项目名称:TheGesichtGedicht-Android,代码行数:10,代码来源:FaceCaptureActivity.java

示例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);
}
 
开发者ID:gsrathoreniks,项目名称:FaceFilter,代码行数:9,代码来源:FaceFilterActivity.java

示例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);
}
 
开发者ID:EzequielAdrianM,项目名称:Camera2Vision,代码行数:11,代码来源:MainActivity.java

示例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);
}
 
开发者ID:square,项目名称:kind-photo-bot,代码行数:5,代码来源:SnapActivity.java

示例11: onMissing

import com.google.android.gms.vision.face.FaceDetector; //导入方法依赖的package包/类
@Override public void onMissing(FaceDetector.Detections<Face> detectionResults) {
  graphicOverlay.forget(this);
  faceGraphic.forgetFace();
}
 
开发者ID:square,项目名称:kind-photo-bot,代码行数:5,代码来源:SnapActivity.java

示例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);
}
 
开发者ID:gsrathoreniks,项目名称:FaceFilter,代码行数:10,代码来源:FaceFilterActivity.java

示例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","" );
}
 
开发者ID:kevalpatel2106,项目名称:UserAwareVideoView,代码行数:10,代码来源:FaceAnalyser.java

示例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) {
}
 
开发者ID:kevalpatel2106,项目名称:Prevent-Screen-Off,代码行数:9,代码来源:FaceAnalyser.java

示例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);
}
 
开发者ID:googlesamples,项目名称:android-vision,代码行数:10,代码来源:GooglyFaceTracker.java


注:本文中的com.google.android.gms.vision.face.FaceDetector.Detections方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。