fix TODOs
diff --git a/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceRecognizer.java b/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceRecognizer.java
index b54605e..58da455 100644
--- a/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceRecognizer.java
+++ b/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceRecognizer.java
@@ -31,7 +31,7 @@
public class FaceRecognizer {
private final FaceStorageBackend storage;
private final FaceFinder detector;
- private final int MINIMUM_MATCHING_MODELS_TF_OD_API = 2;
+ private final int MINIMUM_MATCHING_MODELS_TF_OD_API = 1;
private FaceRecognizer(Context ctx, FaceStorageBackend storage, int inputWidth, int inputHeight, int sensorOrientation, boolean hwAccleration, boolean enhancedHwAccleration, int numThreads) {
this.storage = storage;
diff --git a/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceScanner.java b/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceScanner.java
index d2ce821..bbd8c16 100644
--- a/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceScanner.java
+++ b/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceScanner.java
@@ -77,22 +77,16 @@
// If the class gets instantiated, we enter an special mode of operation for detecting multiple faces on one large Bitmap.
public InputImageProcessor(Bitmap rawImage, int sensorOrientation) {
this.sensorOrientation = sensorOrientation;
- //TODO replace this mess with ImageUtils transform
- int targetW, targetH;
- if (sensorOrientation == 90 || sensorOrientation == 270) {
- targetH = rawImage.getWidth();
- targetW = rawImage.getHeight();
- } else {
- targetW = rawImage.getWidth();
- targetH = rawImage.getHeight();
- }
- Bitmap portraitBmp = Bitmap.createBitmap(targetW, targetH, Bitmap.Config.ARGB_8888);
- transform = ImageUtils.createTransform(
+ Bitmap portraitBmp = Bitmap.createBitmap(
+ (sensorOrientation % 180) == 90 ? rawImage.getHeight() : rawImage.getWidth(),
+ (sensorOrientation % 180) == 90 ? rawImage.getWidth() : rawImage.getHeight(), Bitmap.Config.ARGB_8888);
+ transform = ImageUtils.getTransformationMatrix(
rawImage.getWidth(),
rawImage.getHeight(),
- targetW,
- targetH,
- sensorOrientation);
+ rawImage.getWidth(),
+ rawImage.getHeight(),
+ sensorOrientation,
+ MAINTAIN_ASPECT);
final Canvas cv = new Canvas(portraitBmp);
cv.drawBitmap(rawImage, transform, null);
this.portraitBmp = portraitBmp;
diff --git a/FaceShared/src/main/java/com/libremobileos/yifan/face/ImageUtils.java b/FaceShared/src/main/java/com/libremobileos/yifan/face/ImageUtils.java
index 7aa6cb3..6573714 100644
--- a/FaceShared/src/main/java/com/libremobileos/yifan/face/ImageUtils.java
+++ b/FaceShared/src/main/java/com/libremobileos/yifan/face/ImageUtils.java
@@ -80,20 +80,4 @@
return matrix;
}
-
- // Lightweight alternative to getTransformationMatrix
- public static Matrix createTransform(
- final int srcWidth,
- final int srcHeight,
- final int dstWidth,
- final int dstHeight,
- final int applyRotation) {
- Matrix matrix = new Matrix();
- if (applyRotation != 0) {
- matrix.postTranslate(-srcWidth / 2.0f, -srcHeight / 2.0f);
- matrix.postRotate(applyRotation);
- matrix.postTranslate(dstWidth / 2.0f, dstHeight / 2.0f);
- }
- return matrix;
- }
}
diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml
index 3313dd6..26457c5 100644
--- a/app/src/main/res/xml/backup_rules.xml
+++ b/app/src/main/res/xml/backup_rules.xml
@@ -6,8 +6,5 @@
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
- <!--
- <include domain="sharedpref" path="."/>
- <exclude domain="sharedpref" path="device.xml"/>
--->
+ <exclude domain="sharedpref" path="faces.xml"/>
</full-backup-content>
\ No newline at end of file
diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml
index 4e288ed..3fc20df 100644
--- a/app/src/main/res/xml/data_extraction_rules.xml
+++ b/app/src/main/res/xml/data_extraction_rules.xml
@@ -1,19 +1,14 @@
-<?xml version="1.0" encoding="utf-8"?><!--
+<?xml version="1.0" encoding="utf-8"?>
+<!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
- <!-- TODO: Use <include> and <exclude> to control what is backed up.
- <include .../>
- <exclude .../>
- -->
+ <exclude domain="sharedpref" path="faces.xml" />
</cloud-backup>
- <!--
<device-transfer>
- <include .../>
- <exclude .../>
+ <exclude domain="sharedpref" path="faces.xml" />
</device-transfer>
- -->
</data-extraction-rules>
\ No newline at end of file