예제 #1
0
        public void run() {
          mImageMatrix = mImageView.getImageMatrix();
          Bitmap faceBitmap = prepareBitmap();

          mScale = 1.0F / mScale;
          if (faceBitmap != null) {
            FaceDetector detector =
                new FaceDetector(faceBitmap.getWidth(), faceBitmap.getHeight(), mFaces.length);
            mNumFaces = detector.findFaces(faceBitmap, mFaces);
          }

          if (faceBitmap != null && faceBitmap != mBitmap) {
            faceBitmap.recycle();
          }

          mHandler.post(
              new Runnable() {
                public void run() {
                  mWaitingToPick = mNumFaces > 1;
                  makeDefault();
                  mImageView.invalidate();
                  if (mImageView.mHighlightViews.size() > 0) {
                    mCrop = mImageView.mHighlightViews.get(0);
                    mCrop.setFocus(true);
                  }

                  if (mNumFaces > 1) {}
                }
              });
        }
        public void run() {
          mImageMatrix = mImageView.getImageMatrix();
          Bitmap faceBitmap = prepareBitmap();

          mScale = 1.0F / mScale;
          if (faceBitmap != null && mDoFaceDetection) {
            FaceDetector detector =
                new FaceDetector(faceBitmap.getWidth(), faceBitmap.getHeight(), mFaces.length);
            mNumFaces = detector.findFaces(faceBitmap, mFaces);
          }

          if (faceBitmap != null && faceBitmap != mBitmap) {
            faceBitmap.recycle();
          }

          mHandler.post(
              new Runnable() {
                public void run() {
                  mWaitingToPick = mNumFaces > 1;
                  if (mNumFaces > 0) {
                    for (int i = 0; i < mNumFaces; i++) {
                      handleFace(mFaces[i]);
                    }
                  } else {
                    makeDefault();
                  }
                  mImageView.invalidate();
                  if (mImageView.mHighlightViews.size() == 1) {
                    mCrop = mImageView.mHighlightViews.get(0);
                    mCrop.setFocus(true);
                  }

                  if (mNumFaces > 1) {
                    Toast t =
                        Toast.makeText(
                            CropImageBaseActivity.this,
                            R.string.multiface_crop_help,
                            Toast.LENGTH_SHORT);
                    t.show();
                  }
                }
              });
        }