Code example for FaceDetector

Methods: findFaces

0
    @Override 
    protected Face[] doInBackground(Bitmap... params) {
        mEditBitmap = detect(params[0]);        
        mCanvas = new Canvas(mEditBitmap);
        Face[] faces = new Face[MAX_FACES];
        FaceDetector detector = new FaceDetector(mEditBitmap.getWidth(), mEditBitmap.getHeight(), MAX_FACES);
        mFaceNum = detector.findFaces(mEditBitmap, faces);
        return faces;
    } 
     
    @Override 
    protected void onPostExecute(Face[] faces) {
        if(mWaitDialog!=null) {
            mWaitDialog.dismiss();
        } 
        Paint paint = getPaint();
        String mark = "★";
        FontMetrics fontMetrics = paint.getFontMetrics();
        //小数点切り上げ 
        int textWidth = (int) FloatMath.ceil(paint.measureText(mark));
        // http://wikiwiki.jp/android/?%A5%C6%A5%AD%A5%B9%A5%C8%A4%CE%C9%C1%B2%E8(FontMetrics) 参照