Skip to content

Commit

Permalink
Merge pull request #4 from sergio91pt/point
Browse files Browse the repository at this point in the history
Avoid allocating PointF's in a loop.
  • Loading branch information
ignasi committed May 24, 2014
2 parents 5ff8ff3 + 0a42ca7 commit 974b0f3
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ public Bitmap cropFace(Bitmap original) {
int endX = 0;
int endY = 0;

PointF centerFace = new PointF();

// Calculates minimum box to fit all detected faces
for (int i = 0; i < faceCount; i++) {
FaceDetector.Face face = faces[i];
Expand All @@ -135,7 +137,6 @@ else if (SizeMode.EyeDistanceFactorMargin.equals(mSizeMode)) {

faceSize = Math.max(faceSize, mFaceMinSize);

PointF centerFace = new PointF();
face.getMidPoint(centerFace);

int tInitX = (int) (centerFace.x - faceSize / 2);
Expand Down

0 comments on commit 974b0f3

Please sign in to comment.