本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
}
示例4: getFace
import android.hardware.Camera; //导入方法依赖的package包/类
public Camera.Face getFace(){
return face;
}