当前位置: 首页>>代码示例>>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;未经允许,请勿转载。