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(); }
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(); }
@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(); } }
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(); }
@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; } } }
@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 ); } }
public void setFaces(Face[] faces,boolean isMirror){ this.mFaces = faces; this.isMirror = isMirror; invalidate(); }
@Override public void onFaceDetection(Face[] faces, CameraAgent.CameraProxy camera) { if (mFaceView != null) { mFaceView.setFaces(faces); } }
@Override public void onFaceDetection(Face[] faces, CameraManager.CameraProxy camera) { mFaceView.setFaces(faces); }
@Override public void onFaceDetection(Face[] faces, Camera camera) { Log.d("onFaceDetection", "Number of Faces:" + faces.length); // Update the view now! mFaceView.setFaces(faces); }
public void setFaces(Face[] faces) { mFaces = faces; invalidate(); }
public List<Face> getFacesDetectedList() { return new ArrayList<Face>(this.facesDetected); }
@Override public void onFaceDetection(Face[] faces, Camera camera) { // Load the faces list. facesDetected = new ArrayList<Face>(Arrays.asList(faces)); }