initial prototype
diff --git a/app/src/main/java/com/libremobileos/facedetect/FaceBoundsOverlayView.java b/app/src/main/java/com/libremobileos/facedetect/FaceBoundsOverlayView.java
index dc6933a..88ed9a9 100644
--- a/app/src/main/java/com/libremobileos/facedetect/FaceBoundsOverlayView.java
+++ b/app/src/main/java/com/libremobileos/facedetect/FaceBoundsOverlayView.java
@@ -38,8 +38,6 @@
public FaceBoundsOverlayView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
-
- setWillNotDraw(false);
}
@Override
@@ -57,7 +55,6 @@
transform.mapRect(rect);
rect.offset(0, extra);
canvas.drawRect(rect, paint);
- Log.i("face", Arrays.toString(bounds));
}
}
@@ -66,12 +63,12 @@
super.onSizeChanged(w, h, oldw, oldh);
int newh = (w / 3) * 4;
extra = (h - newh) / 2;
- transform = ImageUtils.getTransformationMatrix(640, 480, w, newh, 0, false);
+ transform = ImageUtils.getTransformationMatrix(480, 640, w, newh, 0, false);
+ transform.preScale(-1, 1, 480 / 2, 640 / 2); // swap x axis
}
public void updateBounds(RectF[] bounds) {
this.bounds = bounds;
- //this.bounds = new RectF[] { new RectF(0, 0, 640/2, 480) };
invalidate();
}
}
diff --git a/app/src/main/java/com/libremobileos/facedetect/MainActivity.java b/app/src/main/java/com/libremobileos/facedetect/MainActivity.java
index 7d50371..16b44da 100644
--- a/app/src/main/java/com/libremobileos/facedetect/MainActivity.java
+++ b/app/src/main/java/com/libremobileos/facedetect/MainActivity.java
@@ -43,7 +43,7 @@
overlayView = findViewById(R.id.overlay);
cameraProviderFuture = ProcessCameraProvider.getInstance(this);
- faceFinder = FaceFinder.create(this, 640, 480, 90);
+ faceFinder = FaceFinder.create(this, 480, 640, 0);
cameraProviderFuture.addListener(() -> {
try {
@@ -70,7 +70,7 @@
ImageAnalysis imageAnalysis =
new ImageAnalysis.Builder()
- .setTargetResolution(new Size(640, 480))
+ .setTargetResolution(new Size(480, 640))
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.build();