有人可以告诉我是否有适用于Android的Face detection
API?如果是这样,有人可以共享链接和任何有用的示例代码吗?
编辑:我需要实时检测(来自相机 - 如同视频)
答案 0 :(得分:1)
android API提供了一个简单的FaceDetector
http://developer.android.com/reference/android/media/FaceDetector.Face.html
答案 1 :(得分:1)
first :: API允许第三方开发人员创建自己的原始应用程序,利用我们的面部识别技术,算法和标记面部数据库。
second :: 面部包含识别位图中面部位置的所有信息。
答案 2 :(得分:0)
答案 3 :(得分:0)
您可以使用FaceDetector类,这是一个基本示例:
public myView(Context context) {
super(context);
BitmapFactory.Options BitmapFactoryOptionsbfo = new BitmapFactory.Options();
BitmapFactoryOptionsbfo.inPreferredConfig = Bitmap.Config.RGB_565;
myBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.threepoint_shooters_1990, BitmapFactoryOptionsbfo);
imageWidth = myBitmap.getWidth();
imageHeight = myBitmap.getHeight();
myFace = new FaceDetector.Face[numberOfFace];
myFaceDetect = new FaceDetector(imageWidth, imageHeight, numberOfFace);
numberOfFaceDetected = myFaceDetect.findFaces(myBitmap, myFace);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawBitmap(myBitmap, 0, 0, null);
Paint myPaint = new Paint();
myPaint.setColor(Color.GREEN);
myPaint.setStyle(Paint.Style.STROKE);
myPaint.setStrokeWidth(3);
for (int i = 0; i < numberOfFaceDetected; i++) {
Face face = myFace[i];
PointF myMidPoint = new PointF();
face.getMidPoint(myMidPoint);
myEyesDistance = face.eyesDistance();
canvas.drawRect((int) (myMidPoint.x - myEyesDistance * 2),
(int) (myMidPoint.y - myEyesDistance * 2),
(int) (myMidPoint.x + myEyesDistance * 2),
(int) (myMidPoint.y + myEyesDistance * 2), myPaint);
}
}
在此处下载完整的源代码: 的 https://github.com/Jorgesys/Android_Face_Detection 强>