Java 类android.hardware.Camera.Face 实例源码

项目:Camera2    文件:FaceView.java   
public void setFaces(Face[] faces) {
    if (LOGV) {
        Log.v(TAG, "Num of faces=" + faces.length);
    }
    if (mPause) return;
    if (mFaces != null) {
        if ((faces.length > 0 && mFaces.length == 0)
                || (faces.length == 0 && mFaces.length > 0)) {
            mPendingFaces = faces;
            if (!mStateSwitchPending) {
                mStateSwitchPending = true;
                mHandler.sendEmptyMessageDelayed(MSG_SWITCH_FACES, SWITCH_DELAY);
            }
            return;
        }
    }
    if (mStateSwitchPending) {
        mStateSwitchPending = false;
        mHandler.removeMessages(MSG_SWITCH_FACES);
    }
    mFaces = faces;
    invalidate();
}
项目:nexus-camera    文件:FaceView.java   
public void setFaces(Face[] faces) {
    if (LOGV) Log.v(TAG, "Num of faces=" + faces.length);
    if (mPause) return;
    if (mFaces != null) {
        if ((faces.length > 0 && mFaces.length == 0)
                || (faces.length == 0 && mFaces.length > 0)) {
            mPendingFaces = faces;
            if (!mStateSwitchPending) {
                mStateSwitchPending = true;
                mHandler.sendEmptyMessageDelayed(MSG_SWITCH_FACES, SWITCH_DELAY);
            }
            return;
        }
    }
    if (mStateSwitchPending) {
        mStateSwitchPending = false;
        mHandler.removeMessages(MSG_SWITCH_FACES);
    }
    mFaces = faces;
    invalidate();
}
项目:VideoFaceDetection    文件:FaceOverlayView.java   
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    if (mFaces != null && mFaces.length > 0) {
        Matrix matrix = new Matrix();
        Util.prepareMatrix(matrix, false, mDisplayOrientation, getWidth(), getHeight());
        canvas.save();
        matrix.postRotate(mOrientation);
        canvas.rotate(-mOrientation);
        RectF rectF = new RectF();
        for (Face face : mFaces) {
            rectF.set(face.rect);
            matrix.mapRect(rectF);
            canvas.drawRect(rectF, mPaint);
            canvas.drawText("Score " + face.score, rectF.right, rectF.top, mTextPaint);
        }
        canvas.restore();
    }
}
项目:WiCamera3D    文件:FaceIndicater.java   
public void setFaces(Face[] faces) {
    // Log.v(TAG, "Num of faces=" + faces.length);
    if (faces != null && faces.length >= 1)
        System.out.println("人脸位置参数" + faces[0].rect.toString());
    mFaces = faces;
    invalidate();

}
项目:cwac-camera    文件:DemoCameraFragment.java   
@Override
public void onFaceDetection(Face[] faces, Camera camera) {
  if (faces.length > 0) {
    long now=SystemClock.elapsedRealtime();

    if (now > lastFaceToast + 10000) {
      Toast.makeText(getActivity(), "I see your face!",
                     Toast.LENGTH_LONG).show();
      lastFaceToast=now;
    }
  }
}
项目:Works-on-My-Box    文件:CameraActivity.java   
@Override
    public void onFaceDetection(Face[] faces, Camera camera) 
    {
        //overlay.reset();
        Log.i( "Stuff",  "Drawing " + faces.length + " rects");

        for( int i=0; i<faces.length; i++ )
        {
            Face f = faces[i];
             android.hardware.Camera.CameraInfo info =
                     new android.hardware.Camera.CameraInfo();
             android.hardware.Camera.getCameraInfo(CameraID, info);

             Matrix matrix = new Matrix();
//           CameraInfo info = CameraHolder.instance().getCameraInfo()[cameraId];
             // Need mirror for front camera.
             boolean mirror = (info.facing == CameraInfo.CAMERA_FACING_FRONT);
             matrix.setScale(mirror ? -1 : 1, 1);
             // This is the value for android.hardware.Camera.setDisplayOrientation.
             matrix.postRotate(currentCameraOrientation);
             // Camera driver coordinates range from (-1000, -1000) to (1000, 1000).
             // UI coordinates range from (0, 0) to (width, height).
             matrix.postScale(overlay.getWidth() / 2000f, overlay.getHeight() / 2000f);
             matrix.postTranslate(overlay.getWidth() / 2f, overlay.getHeight() / 2f);
            overlay.drawRect( f.rect );
        }
    }
项目:FaceRecognition    文件:FaceView.java   
public void setFaces(Face[] faces,boolean isMirror){
    this.mFaces = faces;
    this.isMirror = isMirror;
    invalidate();
}
项目:Camera2    文件:PhotoUI.java   
@Override
public void onFaceDetection(Face[] faces, CameraAgent.CameraProxy camera) {
    if (mFaceView != null) {
        mFaceView.setFaces(faces);
    }
}
项目:nexus-camera    文件:PhotoUI.java   
@Override
public void onFaceDetection(Face[] faces, CameraManager.CameraProxy camera) {
    mFaceView.setFaces(faces);
}
项目:VideoFaceDetection    文件:CameraActivity.java   
@Override
public void onFaceDetection(Face[] faces, Camera camera) {
    Log.d("onFaceDetection", "Number of Faces:" + faces.length);
    // Update the view now!
    mFaceView.setFaces(faces);
}
项目:VideoFaceDetection    文件:FaceOverlayView.java   
public void setFaces(Face[] faces) {
    mFaces = faces;
    invalidate();
}
项目:ironman    文件:IronmanActivity.java   
public List<Face> getFacesDetectedList() {
    return new ArrayList<Face>(this.facesDetected);
}
项目:ironman    文件:IronmanActivity.java   
@Override
public void onFaceDetection(Face[] faces, Camera camera) {
    // Load the faces list.
    facesDetected = new ArrayList<Face>(Arrays.asList(faces));
}