Skip to content

Commit d37b412

Browse files
committed
try to read image from assets
1 parent 081986f commit d37b412

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed
1.62 MB
Loading
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
package dlib.android;
22

3+
import android.content.Context;
4+
import android.graphics.Bitmap;
5+
import android.graphics.BitmapFactory;
6+
import android.support.test.InstrumentationRegistry;
7+
38
import org.junit.Test;
49

5-
import static junit.framework.Assert.assertEquals;
10+
import java.io.IOException;
11+
import java.io.InputStream;
612

713
public class FaceRecognizerTest {
14+
private static final String TAG = "FaceRecognizerTest";
15+
816
@Test
9-
public void RecognizeTest() {
17+
public void RecognizeTest() throws IOException {
1018
FaceRecognizer fr = new FaceRecognizer();
1119
fr.loadNative();
12-
// String res = fr.recognize();
20+
Context testContext = InstrumentationRegistry.getInstrumentation().getContext();
21+
InputStream testInput = testContext.getAssets().open("1.png");
22+
Bitmap bitmap = BitmapFactory.decodeStream(testInput);
23+
// Log.i(TAG, String.format("test1: %d", bitmap.getAllocationByteCount()));
24+
// String res = fr.recognizeNative1(bitmap);
1325
// assertEquals("Unknown", res);
1426
}
1527
}

0 commit comments

Comments
 (0)