android-人脸检测FaceDetector(2)
来源:未知 责任编辑:责任编辑 发表时间:2014-02-02 17:44 点击:次
imageWidth = myBitmap.getWidth();
imageHeight = myBitmap.getHeight();
myFace = new FaceDetector.Face[numberOfFace];
myFaceDetect = new FaceDetector(imageWidth, imageHeight, numberOfFace);
numberOfFaceDetected = myFaceDetect.findFaces(myBitmap, myFace);
}
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
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();
mConfidence = face.confidence();
System.out.println("mConfidence"+mConfidence);
mPose = face.pose(face.EULER_X);
System.out.println("mPose"+mPose);
canvas.drawRect(
(int)(myMidPoint.x - myEyesDistance),
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>