當前位置: 首頁>>代碼示例>>Java>>正文


Java Camera.Face方法代碼示例

本文整理匯總了Java中android.hardware.Camera.Face方法的典型用法代碼示例。如果您正苦於以下問題:Java Camera.Face方法的具體用法?Java Camera.Face怎麽用?Java Camera.Face使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.hardware.Camera的用法示例。


在下文中一共展示了Camera.Face方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFace

import android.hardware.Camera; //導入方法依賴的package包/類
public static Bitmap getFace(Bitmap bitmap, Camera.Face face){
    RectF rectF =  FaceUtil.transform(face.rect,bitmap.getWidth(),bitmap.getHeight());
    //Log.i("s",rectF.left+" "+rectF.top+" "+rectF.right+" "+rectF.bottom+" "+(rectF.right-rectF.left)+" "+(rectF.bottom-rectF.top)+" "+bitmap.getHeight()+" "+bitmap.getWidth());
    rectF = checkInBound(rectF,bitmap.getWidth(),bitmap.getHeight());
    bitmap = Bitmap.createBitmap(
                bitmap,
                Math.round(rectF.left),
                Math.round(rectF.top),
                Math.round(rectF.right)-Math.round(rectF.left),
                Math.round(rectF.bottom)-Math.round(rectF.top)
    );
    return bitmap;
}
 
開發者ID:MarukoZ,項目名稱:FaceRecognition,代碼行數:14,代碼來源:FaceUtil.java

示例2: calculate

import android.hardware.Camera; //導入方法依賴的package包/類
public void calculate(Camera.Face face, boolean mirror)
{
    conversionMatrix.postRotate(mirror ? 90 : 0);

    rect.top = face.rect.top;
    rect.left = face.rect.left;
    rect.right = face.rect.right;
    rect.bottom = face.rect.bottom;

    conversionMatrix.mapRect(rect);

    if (face.leftEye != null)
    {
        leftEye[0] = face.leftEye.x;
        leftEye[1] = face.leftEye.y;

        conversionMatrix.mapPoints(leftEye);
    }

    if (face.rightEye != null)
    {
        rightEye[0] = face.rightEye.x;
        rightEye[1] = face.rightEye.y;

        conversionMatrix.mapPoints(rightEye);
    }

    if (face.mouth != null)
    {
        mouth[0] = face.mouth.x;
        mouth[1] = face.mouth.y;

        conversionMatrix.mapPoints(mouth);
    }

}
 
開發者ID:ravindu1024,項目名稱:android-imaging-utils,代碼行數:37,代碼來源:CameraController.java

示例3: onFaceDetection

import android.hardware.Camera; //導入方法依賴的package包/類
@Override
public void onFaceDetection(Camera.Face[] faces, Camera camera) {
    if (faces.length > 0) {
        Matrix matrix = new Matrix();
        boolean frontCamera = (getCameraType() == RCTCameraModule.RCT_CAMERA_TYPE_FRONT);

        int height = getHeight();
        int width = getWidth();

        matrix.setScale(frontCamera ? -1 : 1, 1);
        matrix.postRotate(RCTCamera.getInstance().getOrientation());
        matrix.postScale(width / 2000f, height / 2000f);
        matrix.postTranslate(width / 2f, height / 2f);

        double pixelDensity = getPixelDensity();

        for (Camera.Face face : faces) {
            RectF faceRect = new RectF(face.rect);
            matrix.mapRect(faceRect);

            WritableMap faceEvent;
            faceEvent = Arguments.createMap();
            faceEvent.putInt("faceID", face.id);
            faceEvent.putBoolean("isFrontCamera", frontCamera);

            faceEvent.putDouble("x", faceRect.left / pixelDensity);
            faceEvent.putDouble("y", faceRect.top / pixelDensity);
            faceEvent.putDouble("h", faceRect.height() / pixelDensity);
            faceEvent.putDouble("w", faceRect.width() / pixelDensity);

            ((ReactContext) getContext()).getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                    .emit("CameraFaceDetected", faceEvent);
        }
    }
}
 
開發者ID:entria,項目名稱:react-native-camera-face-detector,代碼行數:36,代碼來源:RCTCameraViewFinder.java

示例4: getFace

import android.hardware.Camera; //導入方法依賴的package包/類
public Camera.Face getFace(){
	return face;
}
 
開發者ID:MarukoZ,項目名稱:FaceRecognition,代碼行數:4,代碼來源:CameraInterface.java


注:本文中的android.hardware.Camera.Face方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。