diff --git a/_docs/help.html b/_docs/help.html
index 534d9d3370173764e9ba748b8d260a0049932cb5..6677eb0dfe9e163f3fe38c1bc2be633c8506a37f 100644
--- a/_docs/help.html
+++ b/_docs/help.html
@@ -80,6 +80,8 @@
Contacting me (bugs etc)
+
@@ -368,8 +370,6 @@ regions will have their brightness boosted to bring out the detail. This mode is
of brightness (e.g., on a bright sunny day) as well as being useful to automatically optimise photos in low light scenes. Also
see DRO vs HDR.
-Note that if Camera2 API is used, DRO will give improved quality in bright scenes.
-
HDR
High Dynamic Range Imaging (HDR) is a technique where the camera takes multiple shots at different exposures, and combines them
@@ -515,7 +515,7 @@ recording.
delay (see below).
Volume keys - You can set what happens when your device's volume keys are pressed:
-- Take photo or start/stop video (depending on photo/video mode).
+- Take photo or start/stop video (depending on photo/video mode). On Android 7+, volume down will instead pause/resume video when recording video.
- Trigger an autofocus - or if in manual mode, change the focus distance in/out. In this mode, holding down both volume keys
will take a photo (or start/stop video). This makes your volume keys behave more like a physical camera button - hold down one
key to focus, then both to take a photo.
@@ -888,6 +888,10 @@ create the final HDR image (although if you don't want Open Camera's HDR mode at
Exposure Bracketing Photo Mode). Note this will make saving slower, especially if options like "Stamp photos" or
Auto-level are also used.
+HDR tonemapping - When using HDR mode, the high dynamic range image needs to be converted
+back to a regular image, using a process called tonemapping. This option allows you to choose some different
+tonemapping algorithms.
+
HDR contrast enhancement - When using HDR mode, in some (bright) scenes a local contrast
enhancement algorithm is applied to improve the look of the image. It also gives such images a look that is stereotypically
associated with "HDR". If you prefer not to apply this at all, you can change this option from "Smart" to "Off". Or you can
@@ -915,6 +919,11 @@ a third party File Explorer application to see and delete XML files.
photos will still be as the camera (or other people) view the scene. This option can be used to mirror the
resultant photo, so the resultant photo matches the mirrored image you see on the screen.
+Remove device EXIF data - Whether to remove device EXIF metadata from JPEG photos. Note that
+ this will not remove exif tags applied by other Open Camera settings that apply EXIF metadata (e.g.
+ location/geotagging, artist, copyright etc). Those other options are independent and will override this
+ setting. Also note that RAW/DNG and videos are not affected.
+
Artist - If text is entered in this setting, then the text will be stored in the image's Exif metadata as the
"Artist" tag. Only supported for JPEG format. Not supported for RAW photos (DNG format).
diff --git a/_docs/history.html b/_docs/history.html
index 1e08a256c5c225de62ce3fd41262f4ee6bff6022..0a9bde2b3cee5a1d42fe905c2aee91a238599e8e 100644
--- a/_docs/history.html
+++ b/_docs/history.html
@@ -47,6 +47,52 @@
< Main Page.
+Version 1.51.1 (2023/01/02)
+
+FIXED Fix crashes for Camera2 API.
+
+Version 1.51 (2022/12/21)
+
+FIXED Gallery thumbnail had incorrect orientation on some Android 10+ devices.
+FIXED Focus bracketing images came out underexposed on some devices since
+ version 1.50 (e.g. Pixel 6 Pro).
+FIXED Problems with NR, fast burst and long manual exposures on some devices (e.g., Pixel 6 Pro).
+FIXED Face detection on-screen icon shouldn't show in camera vendor extension modes (as not
+ supported).
+FIXED For Camera2 API, red eye flash was incorrectly being shown even on devices that didn't
+ support it.
+FIXED Not saving location exif information for Camera2 API on some devices (e.g., Pixel 6 Pro).
+FIXED Crashed recording video on some devices and resolutions (e.g. Pixel 6 Pro at 1920x1440) if
+ those resolutions didn't support the same frame rate as other resolutions.
+FIXED Don't display error message if using volume keys to turn auto-level on or off in RAW or
+ Panorama mode (unless device doesn't support auto-level at all).
+ADDED New option Settings/Photo settings/"Remove device EXIF data" to remove device metadata from
+ JPEG photos.
+ADDED Shading for auto-level and crop guides, to darken the preview outside of the region of
+ interest.
+ADDED Display message to hold device steady when using X-Night photo mode.
+ADDED New option Settings/Photo settings/"HDR tonemapping" to choose tonemapping algorithm used
+ for HDR photo mode.
+UPDATED Applied a timeout of 1 second for focusing with Camera2 API.
+UPDATED Made it easier to zoom to 1x zoom using seekbar on devices that can zoom out to ultra-wide
+ camera.
+UPDATED Make zoom seekbar snap to powers of two (for Camera2 API).
+UPDATED No longer switch to manual mode in DRO and NR photo modes, as on some devices this meant
+ losing the benefit of manufacturer algorithms.
+UPDATED Volume key down now supports pause/resume video on Android 7+ when recording video, if
+ option for volume keys is set to "Take photo (or start/stop video recording)".
+UPDATED Apply a dimmed effect when reopening camera or switching modes (for Camera2 API).
+UPDATED Improved look of on-screen level line.
+UPDATED On-screen pitch and compass lines now show smaller intervals as camera zooms in.
+UPDATED Improvement to HDR algorithm for dark scenes.
+UPDATED Camera2 extension night mode now adds "_Night" to filename.
+UPDATED Default to Camera2 API for some devices (will only take affect for new installs or if
+ resetting settings).
+UPDATED Default to flash off instead of flash auto.
+UPDATED DRO, HDR, NR modes no longer activate showing full on-screen info toast when opening camera.
+UPDATED Use system toasts without custom views when appropriate.
+UPDATED Display current value for photo stamp font size and colour in preference summary.
+
Version 1.50.1 (2022/06/08)
FIXED Crash on OPPO devices for old camera API introduced in 1.50.
diff --git a/_docs/index.html b/_docs/index.html
index d3bd47db00de4b1371990a0485ceddf6fb4ad970..4eadf078568901d575ad92fac201417e130574f5 100644
--- a/_docs/index.html
+++ b/_docs/index.html
@@ -80,6 +80,8 @@
responsive ads won't show (at least on my Nexus 6)!
If any code is changed here, make sure layout is still good and ads show on laptop, Nexus 6 and Galaxy Nexus.
-->
+
@@ -118,6 +120,7 @@ browsers -->
Overlay a choice of grids and crop guides.
Optional GPS location tagging (geotagging) of photos and videos; for photos this includes compass direction (GPSImgDirection, GPSImgDirectionRef).
Apply date and timestamp, location coordinates, and custom text to photos; store date/time and location as video subtitles (.SRT).
+Option to remove device exif metadata from photos.
Panorama, including for front camera.
Support for HDR (with auto-alignment and ghost removal) and Exposure Bracketing.
Support for Camera2 API: manual controls (with optional focus assist); burst mode; RAW (DNG) files; camera vendor extensions; slow motion video; log profile video.
@@ -151,6 +154,8 @@ browsers -->
+
diff --git a/app/build.gradle b/app/build.gradle
index 64413aafa05be4577654548cd7638c1494aca2b4..c9eee76d4aca09a513fac14b4bf4672938cd5646 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -21,7 +21,8 @@ android {
// also need build tools at least 21 to avoid Google Play 64-bit warning (required from 1 August 2019)
testApplicationId "net.sourceforge.opencamera.test"
- testInstrumentationRunner "android.test.InstrumentationTestRunner"
+ //testInstrumentationRunner "android.test.InstrumentationTestRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -63,4 +64,9 @@ dependencies {
implementation 'foundation.e:elib:0.0.1-alpha11'
testImplementation 'junit:junit:4.13.1'
+
+ // newer AndroidJUnit4 InstrumentedTest
+ androidTestImplementation "androidx.test:runner:1.4.0"
+ androidTestImplementation "androidx.test:rules:1.4.0"
+ androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
}
diff --git a/app/src/androidTest/java/net/sourceforge/opencamera/AvgTestSuite.java b/app/src/androidTest/java/net/sourceforge/opencamera/AvgTestSuite.java
new file mode 100644
index 0000000000000000000000000000000000000000..82f3d6670586c90c40f0ac46308e2fd573a6a88c
--- /dev/null
+++ b/app/src/androidTest/java/net/sourceforge/opencamera/AvgTestSuite.java
@@ -0,0 +1,17 @@
+package net.sourceforge.opencamera;
+
+import org.junit.experimental.categories.Categories;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/** Tests for Avg algorithm - only need to run on a single device
+ * Should manually look over the images dumped onto DCIM/
+ * To use these tests, the testdata/ subfolder should be manually copied to the test device in the DCIM/testOpenCamera/
+ * folder (so you have DCIM/testOpenCamera/testdata/). We don't use assets/ as we'd end up with huge APK sizes which takes
+ * time to transfer to the device every time we run the tests.
+ * On Android 10+, scoped storage permission needs to be given to Open Camera for the DCIM/testOpenCamera/ folder.
+ */
+@RunWith(Categories.class)
+@Categories.IncludeCategory(AvgTests.class)
+@Suite.SuiteClasses({InstrumentedTest.class})
+public class AvgTestSuite {}
diff --git a/app/src/androidTest/java/net/sourceforge/opencamera/HDRNTestSuite.java b/app/src/androidTest/java/net/sourceforge/opencamera/HDRNTestSuite.java
new file mode 100644
index 0000000000000000000000000000000000000000..94314c209612f950a5ba4f98dc64b5488bd0fcb1
--- /dev/null
+++ b/app/src/androidTest/java/net/sourceforge/opencamera/HDRNTestSuite.java
@@ -0,0 +1,17 @@
+package net.sourceforge.opencamera;
+
+import org.junit.experimental.categories.Categories;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/** Tests for HDR algorithm with more than 3 images - only need to run on a single device
+ * Should manually look over the images dumped onto DCIM/
+ * To use these tests, the testdata/ subfolder should be manually copied to the test device in the DCIM/testOpenCamera/
+ * folder (so you have DCIM/testOpenCamera/testdata/). We don't use assets/ as we'd end up with huge APK sizes which takes
+ * time to transfer to the device every time we run the tests.
+ * On Android 10+, scoped storage permission needs to be given to Open Camera for the DCIM/testOpenCamera/ folder.
+ */
+@RunWith(Categories.class)
+@Categories.IncludeCategory(HDRNTests.class)
+@Suite.SuiteClasses({InstrumentedTest.class})
+public class HDRNTestSuite {}
diff --git a/app/src/androidTest/java/net/sourceforge/opencamera/HDRTestSuite.java b/app/src/androidTest/java/net/sourceforge/opencamera/HDRTestSuite.java
new file mode 100644
index 0000000000000000000000000000000000000000..7ecd61239ffc93f031cb06e558ece9f34013e6df
--- /dev/null
+++ b/app/src/androidTest/java/net/sourceforge/opencamera/HDRTestSuite.java
@@ -0,0 +1,17 @@
+package net.sourceforge.opencamera;
+
+import org.junit.experimental.categories.Categories;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/** Tests for HDR algorithm - only need to run on a single device
+ * Should manually look over the images dumped onto DCIM/
+ * To use these tests, the testdata/ subfolder should be manually copied to the test device in the DCIM/testOpenCamera/
+ * folder (so you have DCIM/testOpenCamera/testdata/). We don't use assets/ as we'd end up with huge APK sizes which takes
+ * time to transfer to the device every time we run the tests.
+ * On Android 10+, scoped storage permission needs to be given to Open Camera for the DCIM/testOpenCamera/ folder.
+ */
+@RunWith(Categories.class)
+@Categories.IncludeCategory(HDRTests.class)
+@Suite.SuiteClasses({InstrumentedTest.class})
+public class HDRTestSuite {}
diff --git a/app/src/androidTest/java/net/sourceforge/opencamera/InstrumentedTest.java b/app/src/androidTest/java/net/sourceforge/opencamera/InstrumentedTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..a7fd9bdd8c73fda1c856e0528a592aa6990da0c1
--- /dev/null
+++ b/app/src/androidTest/java/net/sourceforge/opencamera/InstrumentedTest.java
@@ -0,0 +1,6333 @@
+package net.sourceforge.opencamera;
+
+import static androidx.test.espresso.Espresso.onView;
+import static androidx.test.espresso.action.ViewActions.click;
+import static androidx.test.espresso.assertion.ViewAssertions.matches;
+import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+import static org.hamcrest.Matchers.anyOf;
+import static org.hamcrest.Matchers.endsWith;
+import static org.junit.Assert.*;
+
+import android.annotation.TargetApi;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.graphics.Bitmap;
+import android.os.Build;
+import android.os.Looper;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.view.View;
+
+import androidx.test.core.app.ApplicationProvider;
+import androidx.test.espresso.matcher.ViewMatchers;
+import androidx.test.ext.junit.rules.ActivityScenarioRule;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import net.sourceforge.opencamera.ui.DrawPreview;
+import net.sourceforge.opencamera.ui.PopupView;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+
+interface PhotoTests {}
+
+interface HDRTests {}
+
+interface HDRNTests {}
+
+interface AvgTests {}
+
+interface PanoramaTests {}
+
+@RunWith(AndroidJUnit4.class)
+public class InstrumentedTest {
+
+ private static final String TAG = "InstrumentedTest";
+ public static final boolean test_camera2 = false;
+ //public static final boolean test_camera2 = true;
+
+ static final Intent intent;
+ static {
+ // used for code to run before the activity is started
+ intent = new Intent(ApplicationProvider.getApplicationContext(), MainActivity.class);
+ TestUtils.setDefaultIntent(intent);
+ intent.putExtra("test_project_junit4", true);
+
+ // need to run this here, not in before(), so it's run before activity is created (otherwise Camera2 won't be enabled)
+ TestUtils.initTest(ApplicationProvider.getApplicationContext(), test_camera2);
+ }
+
+ @Rule
+ //public ActivityTestRule mActivityRule = new ActivityTestRule<>(MainActivity.class);
+ //public ActivityScenarioRule mActivityRule = new ActivityScenarioRule<>(MainActivity.class);
+ public ActivityScenarioRule mActivityRule = new ActivityScenarioRule<>(intent);
+
+ /** This is run before each test, but after the activity is started (unlike MainActivityTest.setUp() which
+ * is run before the activity is started).
+ */
+ @Before
+ public void before() throws InterruptedException {
+ Log.d(TAG, "before");
+
+ // don't run TestUtils.initTest() here - instead we do it in the static code block, and then
+ // after each test
+
+ // the following was true for MainActivityTest (using ActivityInstrumentationTestCase2), unclear if it's true for
+ // InstrumentedTest:
+ // don't waitUntilCameraOpened() here, as if an assertion fails in setUp(), it can cause later tests to hang in the suite
+ // instead we now wait for camera to open in setToDefault()
+ //waitUntilCameraOpened();
+ }
+
+ @After
+ public void after() throws InterruptedException {
+ Log.d(TAG, "after");
+
+ // As noted above, we need to call TestUtils.initTest() before the activity starts (so in
+ // the static code block, and not before()). But we should still call initTest() before every
+ // subsequent test (so that settings are reset, and test static variables are reset), so
+ // easiest to do this after each test. This also means the application is left in a default
+ // state after running tests.
+ mActivityRule.getScenario().onActivity(activity -> {
+ Log.d(TAG, "after: init");
+ TestUtils.initTest(activity, test_camera2);
+ });
+
+ Log.d(TAG, "after done");
+ }
+
+ private interface GetActivityValueCallback {
+ T get(MainActivity activity);
+ }
+
+ /** This helper method simplifies getting data from the MainActivity.
+ * We can't call MainActivity classes directly, but instead have to go via
+ * mActivityRule.getScenario().onActivity().
+ */
+ private T getActivityValue(GetActivityValueCallback cb) {
+ AtomicReference resultRef = new AtomicReference<>();
+ mActivityRule.getScenario().onActivity(activity -> resultRef.set( cb.get(activity) ));
+ return resultRef.get();
+ }
+
+ private void waitUntilCameraOpened() {
+ Log.d(TAG, "wait until camera opened");
+ long time_s = System.currentTimeMillis();
+
+ boolean done = false;
+ while( !done ) {
+ assertTrue( System.currentTimeMillis() - time_s < 20000 );
+ done = getActivityValue(activity -> activity.getPreview().openCameraAttempted());
+ }
+
+ Log.d(TAG, "camera is open!");
+
+ try {
+ Thread.sleep(100); // sleep a bit just to be safe
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void updateForSettings(MainActivity activity) {
+ Log.d(TAG, "updateForSettings");
+ assertEquals(Looper.getMainLooper().getThread(), Thread.currentThread()); // check on UI thread
+ // updateForSettings has code that must run on UI thread
+ activity.initLocation(); // initLocation now called via MainActivity.setWindowFlagsForCamera() rather than updateForSettings()
+ activity.getApplicationInterface().getDrawPreview().updateSettings();
+ activity.updateForSettings(true);
+
+ waitUntilCameraOpened(); // may need to wait if camera is reopened, e.g., when changing scene mode - see testSceneMode()
+ // but we also need to wait for the delay if instead we've stopped and restarted the preview, the latter now only happens after dim_effect_time_c
+ try {
+ Thread.sleep(DrawPreview.dim_effect_time_c+50); // wait for updateForSettings
+ }
+ catch(InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /** Used to click when we have View instead of an Id. It should only be called from onActivity()
+ * (so that we can be sure we're already on the UI thread).
+ */
+ private void clickView(final View view) {
+ Log.d(TAG, "clickView: "+ view);
+ assertEquals(Looper.getMainLooper().getThread(), Thread.currentThread()); // check on UI thread
+ assertEquals(view.getVisibility(), View.VISIBLE);
+ assertTrue(view.performClick());
+ }
+
+ private void openPopupMenu() {
+ Log.d(TAG, "openPopupMenu");
+ assertFalse( getActivityValue(MainActivity::popupIsOpen) );
+ onView(withId(R.id.popup)).check(matches(isDisplayed()));
+ onView(withId(R.id.popup)).perform(click());
+
+ Log.d(TAG, "wait for popup to open");
+
+ boolean done = false;
+ while( !done ) {
+ done = getActivityValue(MainActivity::popupIsOpen);
+ }
+ Log.d(TAG, "popup is now open");
+ }
+
+ private void switchToFlashValue(String required_flash_value) {
+ Log.d(TAG, "switchToFlashValue: "+ required_flash_value);
+ boolean supports_flash = getActivityValue(activity -> activity.getPreview().supportsFlash());
+ if( supports_flash ) {
+ String flash_value = getActivityValue(activity -> activity.getPreview().getCurrentFlashValue());
+ Log.d(TAG, "start flash_value: "+ flash_value);
+ if( !flash_value.equals(required_flash_value) ) {
+
+ openPopupMenu();
+
+ String flash_value_f = flash_value;
+ mActivityRule.getScenario().onActivity(activity -> {
+ View currentFlashButton = activity.getUIButton("TEST_FLASH_" + flash_value_f);
+ assertNotNull(currentFlashButton);
+ assertEquals(currentFlashButton.getAlpha(), PopupView.ALPHA_BUTTON_SELECTED, 1.0e-5);
+ View flashButton = activity.getUIButton("TEST_FLASH_" + required_flash_value);
+ assertNotNull(flashButton);
+ assertEquals(flashButton.getAlpha(), PopupView.ALPHA_BUTTON, 1.0e-5);
+ clickView(flashButton);
+ });
+
+ flash_value = getActivityValue(activity -> activity.getPreview().getCurrentFlashValue());
+ Log.d(TAG, "changed flash_value to: "+ flash_value);
+ }
+ assertEquals(flash_value, required_flash_value);
+ String controller_flash_value = getActivityValue(activity -> activity.getPreview().getCameraController().getFlashValue());
+ Log.d(TAG, "controller_flash_value: "+ controller_flash_value);
+ if( flash_value.equals("flash_frontscreen_auto") || flash_value.equals("flash_frontscreen_on") ) {
+ // for frontscreen flash, the controller flash value will be "" (due to real flash not supported) - although on Galaxy Nexus this is "flash_off" due to parameters.getFlashMode() returning Camera.Parameters.FLASH_MODE_OFF
+ assertTrue(controller_flash_value.equals("") || controller_flash_value.equals("flash_off"));
+ }
+ else {
+ Log.d(TAG, "expected_flash_value: "+ flash_value);
+ assertEquals(flash_value, controller_flash_value);
+ }
+ }
+ }
+
+ private void switchToFocusValue(String required_focus_value) {
+ Log.d(TAG, "switchToFocusValue: "+ required_focus_value);
+ boolean supports_focus = getActivityValue(activity -> activity.getPreview().supportsFocus());
+ if( supports_focus ) {
+ String focus_value = getActivityValue(activity -> activity.getPreview().getCurrentFocusValue());
+ Log.d(TAG, "start focus_value: "+ focus_value);
+ if( !focus_value.equals(required_focus_value) ) {
+
+ openPopupMenu();
+
+ mActivityRule.getScenario().onActivity(activity -> {
+ View focusButton = activity.getUIButton("TEST_FOCUS_" + required_focus_value);
+ assertNotNull(focusButton);
+ clickView(focusButton);
+ });
+
+ focus_value = getActivityValue(activity -> activity.getPreview().getCurrentFocusValue());
+ Log.d(TAG, "changed focus_value to: "+ focus_value);
+ }
+ assertEquals(focus_value, required_focus_value);
+ String controller_focus_value = getActivityValue(activity -> activity.getPreview().getCameraController().getFocusValue());
+ Log.d(TAG, "controller_focus_value: "+ controller_focus_value);
+ boolean using_camera2 = getActivityValue(activity -> activity.getPreview().usingCamera2API());
+ String compare_focus_value = focus_value;
+ if( compare_focus_value.equals("focus_mode_locked") )
+ compare_focus_value = "focus_mode_auto";
+ else if( compare_focus_value.equals("focus_mode_infinity") && using_camera2 )
+ compare_focus_value = "focus_mode_manual2";
+ assertEquals(compare_focus_value, controller_focus_value);
+ }
+ }
+
+ /* Sets the camera up to a predictable state:
+ * - Flash off (if flash supported)
+ * - Focus mode picture continuous (if focus modes supported)
+ * As a side-effect, the camera and/or camera parameters values may become invalid.
+ */
+ private void setToDefault() {
+ waitUntilCameraOpened();
+
+ assertFalse( getActivityValue(activity -> activity.getPreview().isVideo()) );
+
+ switchToFlashValue("flash_off");
+ switchToFocusValue("focus_mode_continuous_picture");
+
+ // pause for safety - needed for Nokia 8 at least otherwise some tests like testContinuousPictureFocusRepeat,
+ // testLocationOff result in hang whilst waiting for photo to be taken, and hit the timeout in waitForTakePhoto()
+ try {
+ Thread.sleep(200);
+ }
+ catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /*@Test
+ public void testDummy() {
+ Log.d(TAG, "testDummy");
+ }*/
+
+ private static void checkHistogramDetails(TestUtils.HistogramDetails hdrHistogramDetails, int exp_min_value, int exp_median_value, int exp_max_value) {
+ TestUtils.checkHistogramDetails(hdrHistogramDetails, exp_min_value, exp_median_value, exp_max_value);
+ }
+
+ /** Tests calling the DRO routine with 0.0 factor, and DROALGORITHM_NONE - and that the resultant image is identical.
+ */
+ @Category(HDRTests.class)
+ @Test
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ public void testDROZero() throws IOException, InterruptedException {
+ Log.d(TAG, "testDROZero");
+
+ if( Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ) {
+ Log.d(TAG, "renderscript requires Android Lollipop or better");
+ return;
+ }
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ Bitmap bitmap = TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR3/input1.jpg");
+ Bitmap bitmap_saved = bitmap.copy(bitmap.getConfig(), false);
+
+ try {
+ Thread.sleep(1000); // wait for camera to open
+ }
+ catch(InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ List inputs = new ArrayList<>();
+ inputs.add(bitmap);
+ try {
+ activity.getApplicationInterface().getHDRProcessor().processHDR(inputs, true, null, true, null, 0.0f, 4, true, HDRProcessor.TonemappingAlgorithm.TONEMAPALGORITHM_REINHARD, HDRProcessor.DROTonemappingAlgorithm.DROALGORITHM_NONE);
+ }
+ catch(HDRProcessorException e) {
+ e.printStackTrace();
+ throw new RuntimeException();
+ }
+
+ TestUtils.saveBitmap(activity, inputs.get(0), "droZerotestHDR3_output.jpg");
+ TestUtils.checkHistogram(activity, bitmap);
+
+ // check bitmaps are the same
+ Log.d(TAG, "compare bitmap " + bitmap);
+ Log.d(TAG, "with bitmap_saved " + bitmap_saved);
+ // sameAs doesn't seem to work
+ //assertTrue( bitmap.sameAs(bitmap_saved) );
+ assertEquals(bitmap.getWidth(), bitmap_saved.getWidth());
+ assertEquals(bitmap.getHeight(), bitmap_saved.getHeight());
+ int [] old_row = new int[bitmap.getWidth()];
+ int [] new_row = new int[bitmap.getWidth()];
+ for(int y=0;y { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.avg_images_path + "testAvg3/input0.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testDRODark0_output.jpg", true, -1, -1);
+ });
+ }
+
+ /** Tests DRO only on a dark image.
+ */
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ @Category(HDRTests.class)
+ @Test
+ public void testDRODark1() throws IOException, InterruptedException {
+ Log.d(TAG, "testDRODark1");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.avg_images_path + "testAvg8/input0.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testDRODark1_output.jpg", true, -1, -1);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "saintpaul".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR1() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR1");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "saintpaul/input2.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "saintpaul/input3.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "saintpaul/input4.jpg") );
+
+ // actual ISO unknown, so guessing
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR1_output.jpg", false, 1600, 1000000000L);
+
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ //checkHistogramDetails(hdrHistogramDetails, 1, 44, 253);
+ //checkHistogramDetails(hdrHistogramDetails, 1, 42, 253);
+ //checkHistogramDetails(hdrHistogramDetails, 1, 24, 254);
+ checkHistogramDetails(hdrHistogramDetails, 2, 30, 254);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "saintpaul", but with 5 images.
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR1_exp5() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR1_exp5");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "saintpaul/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "saintpaul/input2.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "saintpaul/input3.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "saintpaul/input4.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "saintpaul/input5.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR1_exp5_output.jpg", false, -1, -1);
+
+ int [] exp_offsets_x = {0, 0, 0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 3, 43, 251);
+ checkHistogramDetails(hdrHistogramDetails, 6, 42, 251);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "stlouis".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR2() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR2");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "stlouis/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "stlouis/input2.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "stlouis/input3.jpg") );
+
+ // actual ISO unknown, so guessing
+ TestUtils.subTestHDR(activity, inputs, "testHDR2_output.jpg", false, 1600, (long)(1000000000L*2.5));
+
+ int [] exp_offsets_x = {0, 0, 2};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR3".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR3() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR3");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR3/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR3/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR3/input2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR3_output.jpg", false, 40, 1000000000L/680);
+
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {1, 0, -1};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //TestUtils.checkHistogramDetails(hdrHistogramDetails, 3, 104, 255);
+ //TestUtils.checkHistogramDetails(hdrHistogramDetails, 4, 113, 255);
+ TestUtils.checkHistogramDetails(hdrHistogramDetails, 8, 113, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR4".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR4() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR4");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR4/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR4/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR4/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR4_output.jpg", true, 102, 1000000000L/60);
+
+ int [] exp_offsets_x = {-2, 0, 2};
+ int [] exp_offsets_y = {-1, 0, 1};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR5".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR5() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR5");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR5/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR5/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR5/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR5_output.jpg", false, 40, 1000000000L/398);
+
+ // Nexus 6:
+ //int [] exp_offsets_x = {0, 0, 0};
+ //int [] exp_offsets_y = {-1, 0, 0};
+ // OnePlus 3T:
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR6".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR6() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR6");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR6/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR6/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR6/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR6_output.jpg", false, 40, 1000000000L/2458);
+
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {1, 0, -1};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR7".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR7() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR7");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR7/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR7/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR7/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR7_output.jpg", false, 40, 1000000000L/538);
+
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 1};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR8".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR8() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR8");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR8/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR8/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR8/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR8_output.jpg", false, 40, 1000000000L/148);
+
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR9".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR9() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR9");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR9/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR9/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR9/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR9_output.jpg", false, 40, 1000000000L/1313);
+
+ int [] exp_offsets_x = {-1, 0, 1};
+ int [] exp_offsets_y = {0, 0, -1};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR10".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR10() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR10");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR10/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR10/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR10/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR10_output.jpg", false, 107, 1000000000L/120);
+
+ int [] exp_offsets_x = {2, 0, 0};
+ int [] exp_offsets_y = {5, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR11".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR11() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR11");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR11/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR11/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR11/input2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR11_output.jpg", true, 40, 1000000000L/2662);
+
+ int [] exp_offsets_x = {-2, 0, 1};
+ int [] exp_offsets_y = {1, 0, -1};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 48, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 65, 255);
+ checkHistogramDetails(hdrHistogramDetails, 0, 62, 254);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR12".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR12() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR12");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR12/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR12/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR12/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR12_output.jpg", true, 1196, 1000000000L/12);
+
+ int [] exp_offsets_x = {0, 0, 7};
+ int [] exp_offsets_y = {0, 0, 8};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR13".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR13() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR13");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR13/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR13/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR13/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR13_output.jpg", false, 323, 1000000000L/24);
+
+ int [] exp_offsets_x = {0, 0, 2};
+ int [] exp_offsets_y = {0, 0, -1};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR14".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR14() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR14");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR14/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR14/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR14/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR14_output.jpg", false, 40, 1000000000L/1229);
+
+ int [] exp_offsets_x = {0, 0, 1};
+ int [] exp_offsets_y = {0, 0, -1};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR15".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR15() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR15");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR15/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR15/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR15/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR15_output.jpg", false, 40, 1000000000L/767);
+
+ int [] exp_offsets_x = {1, 0, -1};
+ int [] exp_offsets_y = {2, 0, -3};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR16".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR16() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR16");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR16/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR16/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR16/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR16_output.jpg", false, 52, 1000000000L/120);
+
+ int [] exp_offsets_x = {-1, 0, 2};
+ int [] exp_offsets_y = {1, 0, -6};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR17".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR17() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR17");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR17/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR17/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR17/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR17_output.jpg", true, 557, 1000000000L/12);
+
+ // Nexus 6:
+ //int [] exp_offsets_x = {0, 0, -3};
+ //int [] exp_offsets_y = {0, 0, -4};
+ // OnePlus 3T:
+ int [] exp_offsets_x = {0, 0, -2};
+ int [] exp_offsets_y = {0, 0, -3};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR18".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR18() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR18");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR18/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR18/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR18/input2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR18_output.jpg", true, 100, 1000000000L/800);
+
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 113, 254);
+ //checkHistogramDetails(hdrHistogramDetails, 1, 119, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 5, 120, 255);
+ checkHistogramDetails(hdrHistogramDetails, 2, 120, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR19".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR19() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR19");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR19/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR19/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR19/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR19_output.jpg", true, 100, 1000000000L/160);
+
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR20".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR20() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR20");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR20/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR20/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR20/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR20_output.jpg", true, 100, 1000000000L*2);
+
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {-1, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR21".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR21() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR21");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR21/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR21/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR21/input2.jpg") );
+
+ // ISO and exposure unknown, so guessing
+ TestUtils.subTestHDR(activity, inputs, "testHDR21_output.jpg", true, 800, 1000000000L/12);
+
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR22".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR22() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR22");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR22/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR22/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR22/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR22_output.jpg", true, 391, 1000000000L/12);
+
+ // Nexus 6:
+ //int [] exp_offsets_x = {1, 0, -5};
+ //int [] exp_offsets_y = {1, 0, -6};
+ // OnePlus 3T:
+ int [] exp_offsets_x = {0, 0, -5};
+ int [] exp_offsets_y = {1, 0, -6};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR23", but with 2 images.
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR23_exp2() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR23_exp2");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0068.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0064.png") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR23_exp2_output.jpg", false, -1, -1);
+
+ int [] exp_offsets_x = {0, 0};
+ int [] exp_offsets_y = {0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 13, 72, 250);
+ checkHistogramDetails(hdrHistogramDetails, 24, 72, 250);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR23", but with 2 images, and greater exposure gap.
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR23_exp2b() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR23_exp2b");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0070.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0062.png") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR23_exp2b_output.jpg", false, -1, -1);
+
+ int [] exp_offsets_x = {0, 0};
+ int [] exp_offsets_y = {0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR23".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR23() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR23");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0068.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0066.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0064.png") );
+
+ // ISO unknown, so guessing
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR23_output.jpg", false, 1600, 1000000000L);
+
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 17, 81, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 32, 74, 255);
+ checkHistogramDetails(hdrHistogramDetails, 29, 68, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR23", but with 4 images.
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR23_exp4() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR23_exp4");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0070.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0068.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0064.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0062.png") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR23_exp4_output.jpg", false, -1, -1);
+
+ int [] exp_offsets_x = {0, 0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 15, 69, 254);
+ checkHistogramDetails(hdrHistogramDetails, 24, 70, 254);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR23", but with 5 images.
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR23_exp5() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR23_exp5");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0070.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0068.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0066.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0064.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0062.png") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR23_exp5_output.jpg", false, -1, -1);
+
+ int [] exp_offsets_x = {0, 0, 0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 17, 81, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 28, 82, 255);
+ checkHistogramDetails(hdrHistogramDetails, 21, 74, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR23", but with 6 images.
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR23_exp6() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR23_exp6");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0072.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0070.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0068.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0064.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0062.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0061.png") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR23_exp6_output.jpg", false, -1, -1);
+
+ int [] exp_offsets_x = {0, 0, 0, 0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0, 0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 15, 70, 254);
+ checkHistogramDetails(hdrHistogramDetails, 25, 71, 254);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR23", but with 7 images.
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR23_exp7() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR23_exp7");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0072.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0070.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0068.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0066.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0064.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0062.png") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR23/memorial0061.png") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR23_exp7_output.jpg", false, -1, -1);
+
+ int [] exp_offsets_x = {0, 0, 0, 0, 0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0, 0, 0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 17, 81, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 28, 82, 255);
+ checkHistogramDetails(hdrHistogramDetails, 20, 72, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR24".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR24() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR24");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR24/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR24/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR24/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR24_output.jpg", true, 40, 1000000000L/422);
+
+ int [] exp_offsets_x = {0, 0, 1};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR25".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR25() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR25");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR25/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR25/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR25/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR25_output.jpg", true, 40, 1000000000L/1917);
+
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {1, 0, -1};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR26".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR26() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR26");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR26/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR26/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR26/input2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR26_output.jpg", true, 40, 1000000000L/5325);
+
+ int [] exp_offsets_x = {-1, 0, 1};
+ int [] exp_offsets_y = {1, 0, -1};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 104, 254);
+ checkHistogramDetails(hdrHistogramDetails, 0, 119, 254);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR27".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR27() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR27");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR27/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR27/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR27/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR27_output.jpg", true, 40, 1000000000L/949);
+
+ int [] exp_offsets_x = {0, 0, 2};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR28".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR28() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR28");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR28/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR28/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR28/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR28_output.jpg", true, 294, 1000000000L/20);
+
+ int [] exp_offsets_x = {0, 0, 2};
+ int [] exp_offsets_y = {0, 0, -1};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR29".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR29() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR29");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR29/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR29/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR29/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR29_output.jpg", false, 40, 1000000000L/978);
+
+ int [] exp_offsets_x = {-1, 0, 3};
+ int [] exp_offsets_y = {0, 0, -1};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR30".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR30() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR30");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR30/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR30/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR30/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR30_output.jpg", false, 40, 1000000000L/978);
+
+ // offsets for full image
+ //int [] exp_offsets_x = {-6, 0, -1};
+ //int [] exp_offsets_y = {23, 0, -13};
+ // offsets using centre quarter image
+ int [] exp_offsets_x = {-5, 0, 0};
+ int [] exp_offsets_y = {22, 0, -13};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR31".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR31() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR31");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR31/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR31/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR31/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR31_output.jpg", false, 40, 1000000000L/422);
+
+ // offsets for full image
+ //int [] exp_offsets_x = {0, 0, 4};
+ //int [] exp_offsets_y = {21, 0, -11};
+ // offsets using centre quarter image
+ int [] exp_offsets_x = {0, 0, 3};
+ int [] exp_offsets_y = {21, 0, -11};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR32".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR32() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR32");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR32/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR32/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR32/input2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR32_output.jpg", true, 40, 1000000000L/1331);
+
+ int [] exp_offsets_x = {1, 0, 0};
+ int [] exp_offsets_y = {13, 0, -10};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 3, 101, 251);
+ //checkHistogramDetails(hdrHistogramDetails, 3, 109, 251);
+ //checkHistogramDetails(hdrHistogramDetails, 6, 111, 252);
+ checkHistogramDetails(hdrHistogramDetails, 2, 111, 252);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR33".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR33() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR33");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR33/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR33/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR33/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR33_output.jpg", true, 40, 1000000000L/354);
+
+ int [] exp_offsets_x = {13, 0, -10};
+ int [] exp_offsets_y = {24, 0, -12};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR34".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR34() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR34");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR34/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR34/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR34/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR34_output.jpg", true, 40, 1000000000L/4792);
+
+ int [] exp_offsets_x = {5, 0, -8};
+ int [] exp_offsets_y = {0, 0, -2};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR35".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR35() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR35");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR35/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR35/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR35/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR35_output.jpg", true, 40, 1000000000L/792);
+
+ int [] exp_offsets_x = {-10, 0, 3};
+ int [] exp_offsets_y = {7, 0, -3};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR36".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR36() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR36");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR36/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR36/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR36/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR36_output.jpg", false, 100, 1000000000L/1148);
+
+ int [] exp_offsets_x = {2, 0, -2};
+ int [] exp_offsets_y = {-4, 0, 2};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR37".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR37() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR37");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR37/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR37/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR37/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR37_output.jpg", false, 46, 1000000000L/120);
+
+ int [] exp_offsets_x = {0, 0, 3};
+ int [] exp_offsets_y = {2, 0, -19};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR38".
+ * Tests with Filmic tonemapping.
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR38Filmic() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR38Filmic");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR38/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR38/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR38/input2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR38_filmic_output.jpg", false, 125, 1000000000L/2965, HDRProcessor.TonemappingAlgorithm.TONEMAPALGORITHM_FU2);
+
+ int [] exp_offsets_x = {-1, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 92, 254);
+ checkHistogramDetails(hdrHistogramDetails, 0, 93, 254);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR39".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR39() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR39");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR39/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR39/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR39/input2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR39_output.jpg", false, 125, 1000000000L/2135);
+
+ int [] exp_offsets_x = {-6, 0, -2};
+ int [] exp_offsets_y = {6, 0, -8};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ checkHistogramDetails(hdrHistogramDetails, 0, 128, 222);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR40".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR40() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR40");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR40/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR40/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR40/input2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR40_output.jpg", false, 50, 1000000000L/262);
+
+ int [] exp_offsets_x = {5, 0, -2};
+ int [] exp_offsets_y = {13, 0, 24};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ checkHistogramDetails(hdrHistogramDetails, 1, 138, 254);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR40" with Exponential tonemapping.
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR40Exponential() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR40Exponential");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR40/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR40/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR40/input2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR40_exponential_output.jpg", false, 50, 1000000000L/262, HDRProcessor.TonemappingAlgorithm.TONEMAPALGORITHM_EXPONENTIAL);
+
+ int [] exp_offsets_x = {5, 0, -2};
+ int [] exp_offsets_y = {13, 0, 24};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ checkHistogramDetails(hdrHistogramDetails, 1, 138, 254);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR40" with Filmic tonemapping.
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR40Filmic() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR40Filmic");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR40/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR40/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR40/input2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR40_filmic_output.jpg", false, 50, 1000000000L/262, HDRProcessor.TonemappingAlgorithm.TONEMAPALGORITHM_FU2);
+
+ int [] exp_offsets_x = {5, 0, -2};
+ int [] exp_offsets_y = {13, 0, 24};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+
+ checkHistogramDetails(hdrHistogramDetails, 1, 130, 254);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR41".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR41() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR41");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR41/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR41/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR41/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR41_output.jpg", false, 925, 1000000000L/25);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR42".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR42() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR42");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR42/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR42/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR42/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR42_output.jpg", false, 112, 1000000000L/679);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR43".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR43() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR43");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR43/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR43/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR43/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR43_output.jpg", false, 1196, 1000000000L/12);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR44".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR44() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR44");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR44/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR44/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR44/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR44_output.jpg", false, 100, 1000000000L/1016);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR45".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR45() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR45");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6314.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6312.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6310.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6309.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6311.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6313.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6315.jpg") );
+
+ // ISO 100, exposure time 2s, but pass in -1 since these are HDRNTests
+ TestUtils.subTestHDR(activity, inputs, "testHDR45_output.jpg", false, -1, -1);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR45".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR45_exp5() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR45_exp5");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6314.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6312.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6310.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6309.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6311.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6313.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6315.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR45_exp5_output.jpg", false, -1, -1);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR45".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR45_exp7() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR45_exp7");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6314.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6312.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6310.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6309.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6311.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6313.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR45/IMG_6315.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR45_exp7_output.jpg", false, -1, -1);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR46".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR46() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR46");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR46/Izmir Harbor - ppw - 06.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR46/Izmir Harbor - ppw - 05.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR46/Izmir Harbor - ppw - 04.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR46/Izmir Harbor - ppw - 03.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR46/Izmir Harbor - ppw - 02.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR46/Izmir Harbor - ppw - 01.jpg") );
+
+ // ISO 100, exposure time 1/60s, but pass in -1 since these are HDRNTests
+ TestUtils.subTestHDR(activity, inputs, "testHDR46_output.jpg", false, -1, -1);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR46".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR46_exp5() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR46_exp5");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR46/Izmir Harbor - ppw - 06.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR46/Izmir Harbor - ppw - 05.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR46/Izmir Harbor - ppw - 04.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR46/Izmir Harbor - ppw - 03.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR46/Izmir Harbor - ppw - 02.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR46/Izmir Harbor - ppw - 01.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR46_exp5_output.jpg", false, -1, -1);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR47".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR47_exp2() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR47_exp2");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 05.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 03.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDR47_exp2_output.jpg", false, -1, -1);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR47".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR47() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR47");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 08.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 07.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 06.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 05.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 04.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 03.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 02.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 01.jpg") );
+
+ // ISO 400, exposure time 1/60s, but pass in -1 since these are HDRNTests
+ TestUtils.subTestHDR(activity, inputs, "testHDR47_output.jpg", false, -1, -1);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR47".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR47_exp5() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR47_exp5");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 08.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 07.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 06.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 05.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 04.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 03.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 02.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 01.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR47_exp5_output.jpg", false, -1, -1);
+
+ checkHistogramDetails(hdrHistogramDetails, 1, 73, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR47".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR47_exp7() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR47_exp7");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 08.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 07.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 06.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 05.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 04.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 03.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 02.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR47/High Five - ppw - 01.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR47_exp7_output.jpg", false, -1, -1);
+
+ checkHistogramDetails(hdrHistogramDetails, 1, 73, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR48".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR48() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR48");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR48/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR48/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR48/input2.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR48/input3.jpg") );
+ //inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR48/input4.jpg") );
+
+ // ISO 100, exposure time 1/716s, but pass in -1 since these are HDRNTests
+ TestUtils.subTestHDR(activity, inputs, "testHDR48_output.jpg", false, -1, -1);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR48".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR48_exp5() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR48_exp5");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR48/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR48/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR48/input2.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR48/input3.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR48/input4.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR48_exp5_output.jpg", false, -1, -1);
+
+ checkHistogramDetails(hdrHistogramDetails, 0, 59, 241);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR49".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR49_exp2() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR49_exp2");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input3.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR49_exp2_output.jpg", false, -1, -1);
+
+ checkHistogramDetails(hdrHistogramDetails, 0, 92, 250);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR49".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR49() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR49");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input2.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input3.jpg") );
+
+ // ISO 100, exposure time 1/417s, but pass in -1 since these are HDRNTests
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR49_output.jpg", false, -1, -1);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 75, 255);
+ checkHistogramDetails(hdrHistogramDetails, 0, 81, 254);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR49".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR49_exp4() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR49_exp4");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input3.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input4.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR49_exp4_output.jpg", false, -1, -1);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 100, 245);
+ checkHistogramDetails(hdrHistogramDetails, 0, 94, 244);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR49".
+ */
+ @Category(HDRNTests.class)
+ @Test
+ public void testHDR49_exp5() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR49_exp5");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input2.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input3.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR49/input4.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR49_exp5_output.jpg", false, -1, -1);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 72, 244);
+ checkHistogramDetails(hdrHistogramDetails, 0, 78, 243);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR50".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR50() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR50");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR50/IMG_20180626_221357_0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR50/IMG_20180626_221357_1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR50/IMG_20180626_221357_2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR50_output.jpg", false, 867, 1000000000L/14);
+
+ checkHistogramDetails(hdrHistogramDetails, 0, 69, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR51".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR51() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR51");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR51/IMG_20180323_104702_0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR51/IMG_20180323_104702_1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR51/IMG_20180323_104702_2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR51_output.jpg", true, 1600, 1000000000L/11);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 75, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR52".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR52() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR52");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR52/IMG_20181023_143633_EXP0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR52/IMG_20181023_143633_EXP1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR52/IMG_20181023_143633_EXP2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR52_output.jpg", false, 100, 1000000000L/2105);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 75, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR53".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR53() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR53");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR53/IMG_20181106_135411_EXP0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR53/IMG_20181106_135411_EXP1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR53/IMG_20181106_135411_EXP2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR53_output.jpg", false, 103, 1000000000L/5381);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 55, 254);
+ checkHistogramDetails(hdrHistogramDetails, 0, 64, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR54".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR54() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR54");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR54/IMG_20181107_115508_EXP0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR54/IMG_20181107_115508_EXP1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR54/IMG_20181107_115508_EXP2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR54_output.jpg", false, 752, 1000000000L/14);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 75, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR55".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR55() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR55");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR55/IMG_20181107_115608_EXP0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR55/IMG_20181107_115608_EXP1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR55/IMG_20181107_115608_EXP2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR55_output.jpg", false, 1505, 1000000000L/10);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 75, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR56".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR56() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR56");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR56/180502_141722_OC_0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR56/180502_141722_OC_1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR56/180502_141722_OC_2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR56_output.jpg", false, 50, 1000000000L/40);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 75, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR57".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR57() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR57");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR57/IMG_20181119_145313_EXP0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR57/IMG_20181119_145313_EXP1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR57/IMG_20181119_145313_EXP2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR57_output.jpg", true, 100, 1000000000L/204);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 75, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR58".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR58() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR58");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR58/IMG_20190911_210146_0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR58/IMG_20190911_210146_1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR58/IMG_20190911_210146_2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR58_output.jpg", false, 1250, 1000000000L/10);
+ //HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR58_output.jpg", false, 1250, 1000000000L/10, HDRProcessor.TonemappingAlgorithm.TONEMAPALGORITHM_CLAMP);
+
+ checkHistogramDetails(hdrHistogramDetails, 11, 119, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR59".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR59() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR59");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR59/IMG_20190911_210154_0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR59/IMG_20190911_210154_1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR59/IMG_20190911_210154_2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR59_output.jpg", false, 1250, 1000000000L/10);
+ //HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR59_output.jpg", false, 1250, 1000000000L/10, HDRProcessor.TonemappingAlgorithm.TONEMAPALGORITHM_CLAMP);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 75, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR60".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR60() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR60");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR60/IMG_20200507_020319_0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR60/IMG_20200507_020319_1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR60/IMG_20200507_020319_2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR60_output.jpg", false, 491, 1000000000L/10);
+ //HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR60_output.jpg", false, 491, 1000000000L/10, HDRProcessor.TonemappingAlgorithm.TONEMAPALGORITHM_CLAMP);
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 75, 255);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR61".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR61() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR61");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR61/IMG_20191111_145230_0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR61/IMG_20191111_145230_1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR61/IMG_20191111_145230_2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR61_output.jpg", false, 50, 1000000000L/5025);
+
+ checkHistogramDetails(hdrHistogramDetails, 0, 86, 254);
+
+ int [] exp_offsets_x = {0, 0, 1};
+ int [] exp_offsets_y = {0, 0, -2};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDR62".
+ */
+ @Category(HDRTests.class)
+ @Test
+ public void testHDR62() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDR62");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR62/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR62/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDR62/input2.jpg") );
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestHDR(activity, inputs, "testHDR62_output.jpg", false, 100, 1000000000L/485);
+
+ checkHistogramDetails(hdrHistogramDetails, 0, 113, 247);
+
+ int [] exp_offsets_x = {0, 0, -3};
+ int [] exp_offsets_y = {3, 0, -6};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y);
+ });
+ }
+
+ /** Tests HDR algorithm on test samples "testHDRtemp".
+ * Used for one-off testing, or to recreate HDR images from the base exposures to test an updated algorithm.
+ * The test images should be copied to the test device into DCIM/testOpenCamera/testdata/hdrsamples/testHDRtemp/ .
+ */
+ @Test
+ public void testHDRtemp() throws IOException, InterruptedException {
+ Log.d(TAG, "testHDRtemp");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDRtemp/input0.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDRtemp/input1.jpg") );
+ inputs.add( TestUtils.getBitmapFromFile(activity, TestUtils.hdr_images_path + "testHDRtemp/input2.jpg") );
+
+ TestUtils.subTestHDR(activity, inputs, "testHDRtemp_output.jpg", true, 100, 1000000000L/100);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg1".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg1() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg1");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg1/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg1/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg1/input2.jpg");
+
+ // the input images record ISO=800, but they were taken with OnePlus 3T which has bug where ISO is reported as max
+ // of 800; in reality for a scene this dark, it was probably more like ISO 1600
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity, inputs, "testAvg1_output.jpg", 1600, 1000000000L/17, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ //int [] exp_offsets_x = {0, 3, 0};
+ //int [] exp_offsets_y = {0, 1, 0};
+ //int [] exp_offsets_x = {0, 4, 0};
+ //int [] exp_offsets_y = {0, 1, 0};
+ //int [] exp_offsets_x = {0, 2, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ int [] exp_offsets_x = {0, 4, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 2 ) {
+ //int [] exp_offsets_x = {0, 6, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ //int [] exp_offsets_x = {0, 8, 0};
+ //int [] exp_offsets_y = {0, 1, 0};
+ //int [] exp_offsets_x = {0, 7, 0};
+ //int [] exp_offsets_y = {0, -1, 0};
+ //int [] exp_offsets_x = {0, 8, 0};
+ //int [] exp_offsets_y = {0, -4, 0};
+ int [] exp_offsets_x = {0, 8, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else {
+ fail();
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg2".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg2() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg2");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg2/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg2/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg2/input2.jpg");
+
+ // the input images record ISO=800, but they were taken with OnePlus 3T which has bug where ISO is reported as max
+ // of 800; in reality for a scene this dark, it was probably more like ISO 1600
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg2_output.jpg", 1600, 1000000000L/17, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ //int [] exp_offsets_x = {0, -15, 0};
+ //int [] exp_offsets_y = {0, -10, 0};
+ //int [] exp_offsets_x = {0, -15, 0};
+ //int [] exp_offsets_y = {0, -11, 0};
+ //int [] exp_offsets_x = {0, -12, 0};
+ //int [] exp_offsets_y = {0, -12, 0};
+ int [] exp_offsets_x = {0, -16, 0};
+ int [] exp_offsets_y = {0, -12, 0};
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 2 ) {
+ //int [] exp_offsets_x = {0, -15, 0};
+ //int [] exp_offsets_y = {0, -10, 0};
+ //int [] exp_offsets_x = {0, -13, 0};
+ //int [] exp_offsets_y = {0, -12, 0};
+ //int [] exp_offsets_x = {0, -12, 0};
+ //int [] exp_offsets_y = {0, -14, 0};
+ int [] exp_offsets_x = {0, -12, 0};
+ int [] exp_offsets_y = {0, -12, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else {
+ fail();
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg3".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg3() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg3");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg3/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg3/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg3/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg3/input3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg3/input4.jpg");
+
+ // the input images record ISO=800, but they were taken with OnePlus 3T which has bug where ISO is reported as max
+ // of 800; in reality for a scene this dark, it was probably more like ISO 1600
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg3_output.jpg", 1600, 1000000000L/16, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ /*if( index == 1 ) {
+ //int [] exp_offsets_x = {0, 2, 0};
+ //int [] exp_offsets_y = {0, -18, 0};
+ //int [] exp_offsets_x = {0, -1, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ //int [] exp_offsets_x = {0, -9, 0};
+ //int [] exp_offsets_y = {0, -11, 0};
+ //int [] exp_offsets_x = {0, -8, 0};
+ //int [] exp_offsets_y = {0, -10, 0};
+ int [] exp_offsets_x = {0, -8, 0};
+ int [] exp_offsets_y = {0, -8, 0};
+ assertTrue(activity.getApplicationInterface().getHDRProcessor().sharp_index == 0);
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 2 ) {
+ //int [] exp_offsets_x = {0, -18, 0};
+ //int [] exp_offsets_y = {0, 17, 0};
+ //int [] exp_offsets_x = {0, -2, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ //int [] exp_offsets_x = {0, -7, 0};
+ //int [] exp_offsets_y = {0, -2, 0};
+ //int [] exp_offsets_x = {0, -8, 0};
+ //int [] exp_offsets_y = {0, -8, 0};
+ int [] exp_offsets_x = {0, -12, 0};
+ int [] exp_offsets_y = {0, 8, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 3 ) {
+ //int [] exp_offsets_x = {0, -12, 0};
+ //int [] exp_offsets_y = {0, -25, 0};
+ //int [] exp_offsets_x = {0, -2, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ //int [] exp_offsets_x = {0, -9, 0};
+ //int [] exp_offsets_y = {0, 14, 0};
+ //int [] exp_offsets_x = {0, -8, 0};
+ //int [] exp_offsets_y = {0, 2, 0};
+ //int [] exp_offsets_x = {0, -12, 0};
+ //int [] exp_offsets_y = {0, 12, 0};
+ int [] exp_offsets_x = {0, -12, 0};
+ int [] exp_offsets_y = {0, 4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 4 ) {
+ //int [] exp_offsets_x = {0, -29, 0};
+ //int [] exp_offsets_y = {0, -22, 0};
+ //int [] exp_offsets_x = {0, -2, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ //int [] exp_offsets_x = {0, -7, 0};
+ //int [] exp_offsets_y = {0, 11, 0};
+ //int [] exp_offsets_x = {0, -6, 0};
+ //int [] exp_offsets_y = {0, 14, 0};
+ //int [] exp_offsets_x = {0, -8, 0};
+ //int [] exp_offsets_y = {0, 2, 0};
+ //int [] exp_offsets_x = {0, -8, 0};
+ //int [] exp_offsets_y = {0, 12, 0};
+ int [] exp_offsets_x = {0, -8, 0};
+ int [] exp_offsets_y = {0, 4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else {
+ assertTrue(false);
+ }*/
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 21, 177);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 21, 152);
+ checkHistogramDetails(hdrHistogramDetails, 0, 21, 166);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg4".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg4() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg4");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg4/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg4/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg4/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg4/input3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg4/input4.jpg");
+
+ // the input images record ISO=800, but they were taken with OnePlus 3T which has bug where ISO is reported as max
+ // of 800; in reality for a scene this dark, it was probably more like ISO 1600
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg4_output.jpg", 1600, 1000000000L/16, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ //int [] exp_offsets_x = {0, 5, 0};
+ //int [] exp_offsets_y = {0, 2, 0};
+ int [] exp_offsets_x = {0, 5, 0};
+ int [] exp_offsets_y = {0, 1, 0};
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 2 ) {
+ //int [] exp_offsets_x = {0, 3, 0};
+ //int [] exp_offsets_y = {0, 5, 0};
+ int [] exp_offsets_x = {0, 4, 0};
+ int [] exp_offsets_y = {0, 4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 3 ) {
+ //int [] exp_offsets_x = {0, 0, 0};
+ //int [] exp_offsets_y = {0, 7, 0};
+ //int [] exp_offsets_x = {0, 1, 0};
+ //int [] exp_offsets_y = {0, 6, 0};
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 8, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 4 ) {
+ //int [] exp_offsets_x = {0, 4, 0};
+ //int [] exp_offsets_y = {0, 8, 0};
+ //int [] exp_offsets_x = {0, 3, 0};
+ //int [] exp_offsets_y = {0, 7, 0};
+ //int [] exp_offsets_x = {0, 3, 0};
+ //int [] exp_offsets_y = {0, 8, 0};
+ int [] exp_offsets_x = {0, 3, 0};
+ int [] exp_offsets_y = {0, 9, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else {
+ fail();
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg5".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg5() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg5");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg5/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg5/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg5/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg5/input3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg5/input4.jpg");
+
+ // the input images record ISO=800, but they were taken with OnePlus 3T which has bug where ISO is reported as max
+ // of 800; in reality for a scene this dark, it was probably more like ISO 1600
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg5_output.jpg", 1600, 1000000000L/16, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ /*if( index == 1 ) {
+ //int [] exp_offsets_x = {0, 4, 0};
+ //int [] exp_offsets_y = {0, -1, 0};
+ //int [] exp_offsets_x = {0, 5, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ //int [] exp_offsets_x = {0, 6, 0};
+ //int [] exp_offsets_y = {0, -2, 0};
+ int [] exp_offsets_x = {0, 4, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ assertTrue(activity.getApplicationInterface().getHDRProcessor().sharp_index == 0);
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 2 ) {
+ //int [] exp_offsets_x = {0, 7, 0};
+ //int [] exp_offsets_y = {0, -2, 0};
+ //int [] exp_offsets_x = {0, 8, 0};
+ //int [] exp_offsets_y = {0, -1, 0};
+ int [] exp_offsets_x = {0, 8, 0};
+ int [] exp_offsets_y = {0, -4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 3 ) {
+ //int [] exp_offsets_x = {0, 9, 0};
+ //int [] exp_offsets_y = {0, -2, 0};
+ //int [] exp_offsets_x = {0, 8, 0};
+ //int [] exp_offsets_y = {0, -1, 0};
+ int [] exp_offsets_x = {0, 8, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 4 ) {
+ //int [] exp_offsets_x = {0, 10, 0};
+ //int [] exp_offsets_y = {0, -4, 0};
+ int [] exp_offsets_x = {0, 11, 0};
+ int [] exp_offsets_y = {0, -3, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else {
+ assertTrue(false);
+ }*/
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg6".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg6() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg6");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg6/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg6/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg6/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg6/input3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg6/input4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg6/input5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg6/input6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg6/input7.jpg");
+
+ // the input images record ISO=800, but they were taken with OnePlus 3T which has bug where ISO is reported as max
+ // of 800; in reality for a scene this dark, it was probably more like ISO 1600
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg6_output.jpg", 1600, 1000000000L/17, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ /*if( true )
+ return;*/
+ if( index == 1 ) {
+ //int [] exp_offsets_x = {0, 0, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ //int [] exp_offsets_x = {0, -2, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ else if( index == 2 ) {
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 3 ) {
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 4 ) {
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 5 ) {
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 6 ) {
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 7 ) {
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else {
+ fail();
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 18, 51, 201);
+ //checkHistogramDetails(hdrHistogramDetails, 14, 38, 200);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 9, 193);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 9, 199);
+ //checkHistogramDetails(hdrHistogramDetails, 12, 46, 202);
+ //checkHistogramDetails(hdrHistogramDetails, 12, 46, 205);
+ //checkHistogramDetails(hdrHistogramDetails, 12, 44, 209);
+ //checkHistogramDetails(hdrHistogramDetails, 12, 44, 202);
+ //checkHistogramDetails(hdrHistogramDetails, 5, 16, 190);
+ checkHistogramDetails(hdrHistogramDetails, 5, 19, 199);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg7".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg7() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg7");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg7/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg7/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg7/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg7/input3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg7/input4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg7/input5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg7/input6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg7/input7.jpg");
+
+ // the input images record ISO=800, but they were taken with OnePlus 3T which has bug where ISO is reported as max
+ // of 800; in reality for a scene this dark, it was probably more like ISO 1600
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg7_output.jpg", 1600, 1000000000L/16, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ //int [] exp_offsets_x = {0, 0, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ //int [] exp_offsets_x = {0, -10, 0};
+ //int [] exp_offsets_y = {0, 6, 0};
+ //int [] exp_offsets_x = {0, -6, 0};
+ //int [] exp_offsets_y = {0, 2, 0};
+ //int [] exp_offsets_x = {0, -4, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ //int [] exp_offsets_x = {0, 0, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ //int [] exp_offsets_x = {0, -4, 0};
+ //int [] exp_offsets_y = {0, 0, 0};
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg8".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg8() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg8");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg8/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg8/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg8/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg8/input3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg8/input4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg8/input5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg8/input6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg8/input7.jpg");
+
+ // the input images record ISO=800, but they were taken with OnePlus 3T which has bug where ISO is reported as max
+ // of 800; in reality for a scene this dark, it was probably more like ISO 1600
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg8_output.jpg", 1600, 1000000000L/16, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 4, 26, 92);
+ //checkHistogramDetails(hdrHistogramDetails, 3, 19, 68);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 10, 60);
+ //checkHistogramDetails(hdrHistogramDetails, 1, 8, 72);
+ //checkHistogramDetails(hdrHistogramDetails, 1, 6, 64);
+ //checkHistogramDetails(hdrHistogramDetails, 1, 15, 75);
+ checkHistogramDetails(hdrHistogramDetails, 1, 16, 78);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg9".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg9() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg9");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ final boolean use_auto_photos = true;
+
+ if( use_auto_photos ) {
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input_auto0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input_auto1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input_auto2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input_auto3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input_auto4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input_auto5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input_auto6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input_auto7.jpg");
+ }
+ else {
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg9/input7.jpg");
+ }
+
+ String out_filename = use_auto_photos ? "testAvg9_auto_output.jpg" : "testAvg9_output.jpg";
+
+ // the input images record ISO=800, but they were taken with OnePlus 3T which has bug where ISO is reported as max
+ // of 800; in reality for a scene this dark, it was probably more like ISO 1600
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, out_filename, 1600, use_auto_photos ? 1000000000L/16 : 1000000000L/11, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg10".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg10() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg10");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ final boolean use_auto_photos = false;
+
+ if( use_auto_photos ) {
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input_auto0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input_auto1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input_auto2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input_auto3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input_auto4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input_auto5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input_auto6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input_auto7.jpg");
+ }
+ else {
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg10/input7.jpg");
+ }
+
+ String out_filename = use_auto_photos ? "testAvg10_auto_output.jpg" : "testAvg10_output.jpg";
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, out_filename, 1196, use_auto_photos ? 1000000000L/12 : 1000000000L/10, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg11".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg11() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg11");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // note, we don't actually use 8 images for a bright scene like this, but it serves as a good test for
+ // misalignment/ghosting anyway
+ inputs.add(TestUtils.avg_images_path + "testAvg11/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg11/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg11/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg11/input3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg11/input4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg11/input5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg11/input6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg11/input7.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg11_output.jpg", 100, 1000000000L/338, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ //int [] exp_offsets_x = {0, 4, 0};
+ //int [] exp_offsets_y = {0, -8, 0};
+ //int [] exp_offsets_x = {0, 6, 0};
+ //int [] exp_offsets_y = {0, -8, 0};
+ //int [] exp_offsets_x = {0, -6, 0};
+ //int [] exp_offsets_y = {0, 8, 0};
+ int [] exp_offsets_x = {0, -4, 0};
+ int [] exp_offsets_y = {0, 8, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ //assertTrue(activity.getApplicationInterface().getHDRProcessor().sharp_index == 1);
+ }
+ else if( index == 2 ) {
+ //int [] exp_offsets_x = {0, -5, 0};
+ //int [] exp_offsets_y = {0, -1, 0};
+ //int [] exp_offsets_x = {0, -10, 0};
+ //int [] exp_offsets_y = {0, 6, 0};
+ int [] exp_offsets_x = {0, -8, 0};
+ int [] exp_offsets_y = {0, 8, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 3 ) {
+ //int [] exp_offsets_x = {0, -1, 0};
+ //int [] exp_offsets_y = {0, -18, 0};
+ //int [] exp_offsets_x = {0, 0, 0};
+ //int [] exp_offsets_y = {0, -16, 0};
+ //int [] exp_offsets_x = {0, -4, 0};
+ //int [] exp_offsets_y = {0, -10, 0};
+ //int [] exp_offsets_x = {0, -4, 0};
+ //int [] exp_offsets_y = {0, -8, 0};
+ int [] exp_offsets_x = {0, -4, 0};
+ int [] exp_offsets_y = {0, -12, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 4 ) {
+ //int [] exp_offsets_x = {0, -3, 0};
+ //int [] exp_offsets_y = {0, -20, 0};
+ //int [] exp_offsets_x = {0, -2, 0};
+ //int [] exp_offsets_y = {0, -18, 0};
+ //int [] exp_offsets_x = {0, -6, 0};
+ //int [] exp_offsets_y = {0, -12, 0};
+ int [] exp_offsets_x = {0, -8, 0};
+ int [] exp_offsets_y = {0, -12, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 5 ) {
+ //int [] exp_offsets_x = {0, -8, 0};
+ //int [] exp_offsets_y = {0, 2, 0};
+ //int [] exp_offsets_x = {0, -10, 0};
+ //int [] exp_offsets_y = {0, 4, 0};
+ //int [] exp_offsets_x = {0, -12, 0};
+ //int [] exp_offsets_y = {0, 10, 0};
+ int [] exp_offsets_x = {0, -12, 0};
+ int [] exp_offsets_y = {0, 8, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 6 ) {
+ //int [] exp_offsets_x = {0, 0, 0};
+ //int [] exp_offsets_y = {0, -6, 0};
+ //int [] exp_offsets_x = {0, 2, 0};
+ //int [] exp_offsets_y = {0, -6, 0};
+ //int [] exp_offsets_x = {0, -4, 0};
+ //int [] exp_offsets_y = {0, 2, 0};
+ int [] exp_offsets_x = {0, -4, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 7 ) {
+ //int [] exp_offsets_x = {0, 7, 0};
+ //int [] exp_offsets_y = {0, -2, 0};
+ //int [] exp_offsets_x = {0, 6, 0};
+ //int [] exp_offsets_y = {0, 6, 0};
+ //int [] exp_offsets_x = {0, 4, 0};
+ //int [] exp_offsets_y = {0, 4, 0};
+ //int [] exp_offsets_x = {0, 8, 0};
+ //int [] exp_offsets_y = {0, 8, 0};
+ int [] exp_offsets_x = {0, 4, 0};
+ int [] exp_offsets_y = {0, 4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else {
+ fail();
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg12".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg12() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg12");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg12/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg12/input1.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg12_output.jpg", 100, 1000000000L/1617, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ //assertTrue(activity.getApplicationInterface().getHDRProcessor().sharp_index == 1);
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 30, 254);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 27, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 20, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 17, 254);
+ checkHistogramDetails(hdrHistogramDetails, 0, 31, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg13".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg13() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg13");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg13/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg13/input1.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg13_output.jpg", 100, 1000000000L/2482, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ //assertTrue(activity.getApplicationInterface().getHDRProcessor().sharp_index == 1);
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg14".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg14() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg14");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg14/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg14/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg14/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg14/input3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg14/input4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg14/input5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg14/input6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg14/input7.jpg");
+
+ // the input images record ISO=800, but they were taken with OnePlus 3T which has bug where ISO is reported as max
+ // of 800; in reality for a scene this dark, it was probably more like ISO 1600
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg14_output.jpg", 1600, 1000000000L/10, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ int [] exp_offsets_x = {0, -8, 0};
+ int [] exp_offsets_y = {0, -8, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ else if( index == 7 ) {
+ //int [] exp_offsets_x = {0, 4, 0};
+ //int [] exp_offsets_y = {0, 28, 0};
+ int [] exp_offsets_x = {0, 4, 0};
+ int [] exp_offsets_y = {0, 40, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ }
+ });
+
+ checkHistogramDetails(hdrHistogramDetails, 0, 25, 245);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg15".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg15() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg15");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg15/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg15/input1.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg15_output.jpg", 100, 1000000000L/1525, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ }
+ });
+
+ checkHistogramDetails(hdrHistogramDetails, 0, 38, 254);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg16".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg16() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg16");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg16/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg16/input1.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg16_output.jpg", 100, 1000000000L/293, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ //assertTrue(activity.getApplicationInterface().getHDRProcessor().sharp_index == 1);
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg17".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg17() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg17");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg17/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg17/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg17/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg17/input3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg17/input4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg17/input5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg17/input6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg17/input7.jpg");
+
+ // the input images record ISO=800, but they were taken with OnePlus 3T which has bug where ISO is reported as max
+ // of 800; in reality for a scene this dark, it was probably more like ISO 1600
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg17_output.jpg", 1600, 1000000000L/17, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ int [] exp_offsets_x = {0, -8, 0};
+ int [] exp_offsets_y = {0, 4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ else if( index == 7 ) {
+ int [] exp_offsets_x = {0, 12, 0};
+ int [] exp_offsets_y = {0, 28, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 100, 233);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 100, 236);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 92, 234);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 102, 241);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 102, 238);
+ checkHistogramDetails(hdrHistogramDetails, 0, 103, 244);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg18".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg18() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg18");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg18/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg18/input1.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg18_output.jpg", 100, 1000000000L/591, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ //assertTrue(activity.getApplicationInterface().getHDRProcessor().sharp_index == 1);
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg19".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg19() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg19");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // repeat same image twice
+ inputs.add(TestUtils.avg_images_path + "testAvg19/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg19/input0.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg19_output.jpg", 100, 1000000000L/2483, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 88, 252);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 77, 252);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 87, 252);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 74, 255);
+ checkHistogramDetails(hdrHistogramDetails, 0, 58, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg20".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg20() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg20");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // repeat same image twice
+ inputs.add(TestUtils.avg_images_path + "testAvg20/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg20/input0.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg20_output.jpg", 100, 1000000000L/3124, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg21".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg21() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg21");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // repeat same image twice
+ inputs.add(TestUtils.avg_images_path + "testAvg21/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg21/input0.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg21_output.jpg", 102, 1000000000L/6918, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg22".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg22() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg22");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // repeat same image twice
+ inputs.add(TestUtils.avg_images_path + "testAvg22/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg22/input0.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg22_output.jpg", 100, 1000000000L/3459, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg23".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg23() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg23");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg23/IMG_20180520_111250_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg23/IMG_20180520_111250_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg23/IMG_20180520_111250_2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg23/IMG_20180520_111250_3.jpg");
+ // only test 4 images, to reflect latest behaviour that we take 4 images for this ISO
+ /*inputs.add(TestUtils.avg_images_path + "testAvg23/IMG_20180520_111250_4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg23/IMG_20180520_111250_5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg23/IMG_20180520_111250_6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg23/IMG_20180520_111250_7.jpg");*/
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg23_output.jpg", 1044, 1000000000L/10, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ int [] exp_offsets_x = {0, -4, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 2 ) {
+ int [] exp_offsets_x = {0, -4, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 3 ) {
+ int [] exp_offsets_x = {0, -8, 0};
+ int [] exp_offsets_y = {0, 4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 4 ) {
+ int [] exp_offsets_x = {0, -8, 0};
+ int [] exp_offsets_y = {0, 4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 5 ) {
+ int [] exp_offsets_x = {0, -12, 0};
+ int [] exp_offsets_y = {0, 4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 6 ) {
+ int [] exp_offsets_x = {0, -12, 0};
+ int [] exp_offsets_y = {0, 4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 7 ) {
+ int [] exp_offsets_x = {0, -12, 0};
+ int [] exp_offsets_y = {0, 4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else {
+ fail();
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 81, 251);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 80, 255);
+ checkHistogramDetails(hdrHistogramDetails, 0, 83, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg24".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg24() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg24");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg24/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg24/input1.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg24_output.jpg", 100, 1000000000L/2421, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 77, 250);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 74, 250);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 86, 250);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 86, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 80, 254);
+ checkHistogramDetails(hdrHistogramDetails, 0, 56, 254);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg25".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg25() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg25");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg25/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg25/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg25/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg25/input3.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg25_output.jpg", 512, 1000000000L/20, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg26".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg26() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg26");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // note we now take only 3 images for bright scenes, but still test with 4 images as this serves as a good test
+ // against ghosting
+ inputs.add(TestUtils.avg_images_path + "testAvg26/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg26/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg26/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg26/input3.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg26_output.jpg", 100, 1000000000L/365, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ /*if( true )
+ return;*/
+ if( index == 1 ) {
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 2 ) {
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 3 ) {
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, -4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else {
+ fail();
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg27".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg27() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg27");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg27/IMG_20180610_205929_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg27/IMG_20180610_205929_1.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg27_output.jpg", 100, 1000000000L/482, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg28".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg28() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg28");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // example from Google HDR+ dataset
+ // note, the number of input images doesn't necessarily match what we'd take for this scene, but we want to compare
+ // to the Google HDR+ result
+ inputs.add(TestUtils.avg_images_path + "testAvg28/input001.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg28/input002.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg28/input003.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg28/input004.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg28/input005.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg28/input006.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg28/input007.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg28/input008.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg28_output.jpg", 811, 1000000000L/21, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 21, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 18, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 8, 255);
+ checkHistogramDetails(hdrHistogramDetails, 0, 13, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg29".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg29() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg29");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // example from Google HDR+ dataset
+ // note, the number of input images doesn't necessarily match what we'd take for this scene, but we want to compare
+ // to the Google HDR+ result
+ inputs.add(TestUtils.avg_images_path + "testAvg29/input001.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg29/input002.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg29/input003.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg29/input004.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg29/input005.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg29/input006.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg29/input007.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg29/input008.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg29/input009.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg29_output.jpg", 40, 1000000000L/2660, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 88, 127, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 92, 134, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg30".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg30() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg30");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // example from Google HDR+ dataset
+ // note, the number of input images doesn't necessarily match what we'd take for this scene, but we want to compare
+ // to the Google HDR+ result
+ inputs.add(TestUtils.avg_images_path + "testAvg30/input001.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg30/input002.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg30/input003.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg30_output.jpg", 60, 1000000000L/411, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 2 ) {
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, -4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 3 ) {
+ int [] exp_offsets_x = {0, 0, 0};
+ int [] exp_offsets_y = {0, -4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else {
+ fail();
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 134, 254);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 144, 254);
+ checkHistogramDetails(hdrHistogramDetails, 0, 107, 254);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg31".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg31() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg31");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // example from Google HDR+ dataset
+ // note, the number of input images doesn't necessarily match what we'd take for this scene, but we want to compare
+ // to the Google HDR+ result
+ inputs.add(TestUtils.avg_images_path + "testAvg31/input001.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg31/input002.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg31/input003.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg31/input004.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg31/input005.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg31/input006.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg31/input007.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg31/input008.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg31/input009.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg31/input010.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg31_output.jpg", 609, 1000000000L/25, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 24, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 9, 255);
+ checkHistogramDetails(hdrHistogramDetails, 0, 13, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg32".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg32() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg32");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // example from Google HDR+ dataset
+ // note, the number of input images doesn't necessarily match what we'd take for this scene, but we want to compare
+ // to the Google HDR+ result
+ inputs.add(TestUtils.avg_images_path + "testAvg32/input001.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg32/input002.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg32/input003.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg32/input004.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg32/input005.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg32/input006.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg32/input007.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg32_output.jpg", 335, 1000000000L/120, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 34, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 13, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 36, 255);
+ checkHistogramDetails(hdrHistogramDetails, 0, 61, 254);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg33".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg33() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg33");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // example from Google HDR+ dataset
+ // note, the number of input images doesn't necessarily match what we'd take for this scene, but we want to compare
+ // to the Google HDR+ result
+ inputs.add(TestUtils.avg_images_path + "testAvg33/input001.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg33/input002.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg33/input003.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg33/input004.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg33/input005.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg33/input006.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg33/input007.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg33/input008.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg33/input009.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg33/input010.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg33_output.jpg", 948, 1000000000L/18, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 81, 255);
+ checkHistogramDetails(hdrHistogramDetails, 0, 63, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg34".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg34() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg34");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg34/IMG_20180627_121959_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg34/IMG_20180627_121959_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg34/IMG_20180627_121959_2.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg34_output.jpg", 100, 1000000000L/289, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 86, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 108, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 114, 254);
+ checkHistogramDetails(hdrHistogramDetails, 0, 103, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg35".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg35() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg35");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg35/IMG_20180711_144453_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg35/IMG_20180711_144453_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg35/IMG_20180711_144453_2.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg35_output.jpg", 100, 1000000000L/2549, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 165, 247);
+ checkHistogramDetails(hdrHistogramDetails, 0, 169, 248);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg36".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg36() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg36");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg36/IMG_20180709_114831_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg36/IMG_20180709_114831_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg36/IMG_20180709_114831_2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg36/IMG_20180709_114831_3.jpg");
+ // only test 4 images, to reflect latest behaviour that we take 4 images for this ISO/exposure time
+ /*inputs.add(TestUtils.avg_images_path + "testAvg36/IMG_20180709_114831_4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg36/IMG_20180709_114831_5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg36/IMG_20180709_114831_6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg36/IMG_20180709_114831_7.jpg");*/
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg36_output.jpg", 752, 1000000000L/10, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ int [] exp_offsets_x = {0, -12, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ else if( index == 3 ) {
+ int [] exp_offsets_x = {0, -28, 0};
+ int [] exp_offsets_y = {0, 0, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 86, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg37".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg37() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg37");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg37/IMG_20180715_173155_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg37/IMG_20180715_173155_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg37/IMG_20180715_173155_2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg37/IMG_20180715_173155_3.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg37_output.jpg", 131, 1000000000L/50, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 12, 109, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 3, 99, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 99, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 125, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 94, 255);
+ checkHistogramDetails(hdrHistogramDetails, 6, 94, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg38".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg38() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg38");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg38/IMG_20180716_232102_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg38/IMG_20180716_232102_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg38/IMG_20180716_232102_2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg38/IMG_20180716_232102_3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg38/IMG_20180716_232102_4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg38/IMG_20180716_232102_5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg38/IMG_20180716_232102_6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg38/IMG_20180716_232102_7.jpg");
+
+ // n.b., this was a zoomed in photo, but can't quite remember the exact zoom level!
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg38_output.jpg", 1505, 1000000000L/10, 3.95f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg39".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg39() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg39");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // example from Google HDR+ dataset
+ // note, the number of input images doesn't necessarily match what we'd take for this scene, but we want to compare
+ // to the Google HDR+ result
+ inputs.add(TestUtils.avg_images_path + "testAvg39/input001.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg39/input002.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg39/input003.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg39/input004.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg39/input005.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg39/input006.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg39/input007.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg39/input008.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg39/input009.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg39/input010.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg39_output.jpg", 521, 1000000000L/27, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 64, 255);
+ checkHistogramDetails(hdrHistogramDetails, 0, 25, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg40".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg40() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg40");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // example from Google HDR+ dataset
+ // note, the number of input images doesn't necessarily match what we'd take for this scene, but we want to compare
+ // to the Google HDR+ result
+ inputs.add(TestUtils.avg_images_path + "testAvg40/input001.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg40/input002.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg40/input003.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg40/input004.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg40/input005.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg40/input006.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg40/input007.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg40/input008.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg40/input009.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg40_output.jpg", 199, 1000000000L/120, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 50, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 19, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 50, 255);
+ checkHistogramDetails(hdrHistogramDetails, 0, 67, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg41".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg41() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg41");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ // example from Google HDR+ dataset
+ // note, the number of input images doesn't necessarily match what we'd take for this scene, but we want to compare
+ // to the Google HDR+ result
+ inputs.add(TestUtils.avg_images_path + "testAvg41/input001.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg41/input002.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg41/input003.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg41/input004.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg41/input005.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg41/input006.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg41/input007.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg41/input008.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg41/input009.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg41/input010.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg41_output.jpg", 100, 1000000000L/869, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 49, 255);
+ //checkHistogramDetails(hdrHistogramDetails, 0, 37, 255);
+ checkHistogramDetails(hdrHistogramDetails, 0, 59, 254);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg42".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg42() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg42");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg42/IMG_20180822_145152_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg42/IMG_20180822_145152_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg42/IMG_20180822_145152_2.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg42_output.jpg", 100, 1000000000L/2061, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 67, 254);
+ checkHistogramDetails(hdrHistogramDetails, 0, 61, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg43".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg43() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg43");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg43/IMG_20180831_143226_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg43/IMG_20180831_143226_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg43/IMG_20180831_143226_2.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg43_output.jpg", 100, 1000000000L/2152, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ checkHistogramDetails(hdrHistogramDetails, 0, 69, 253);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg44".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg44() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg44");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg44/IMG_20180830_133917_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg44/IMG_20180830_133917_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg44/IMG_20180830_133917_2.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg44_output.jpg", 40, 1000000000L/2130, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ checkHistogramDetails(hdrHistogramDetails, 0, 75, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg45".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg45() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg45");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg45/IMG_20180719_133947_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg45/IMG_20180719_133947_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg45/IMG_20180719_133947_2.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg45_output.jpg", 100, 1000000000L/865, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 75, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg46".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg46() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg46");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg46/IMG_20180903_203141_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg46/IMG_20180903_203141_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg46/IMG_20180903_203141_2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg46/IMG_20180903_203141_3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg46/IMG_20180903_203141_4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg46/IMG_20180903_203141_5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg46/IMG_20180903_203141_6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg46/IMG_20180903_203141_7.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg46_output.jpg", 1505, 1000000000L/10, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ checkHistogramDetails(hdrHistogramDetails, 0, 30, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg47".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg47() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg47");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg47/IMG_20180911_114752_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg47/IMG_20180911_114752_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg47/IMG_20180911_114752_2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg47/IMG_20180911_114752_3.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg47_output.jpg", 749, 1000000000L/12, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 30, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg48".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg48() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg48");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg48/IMG_20180911_110520_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg48/IMG_20180911_110520_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg48/IMG_20180911_110520_2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg48/IMG_20180911_110520_3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg48/IMG_20180911_110520_4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg48/IMG_20180911_110520_5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg48/IMG_20180911_110520_6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg48/IMG_20180911_110520_7.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg48_output.jpg", 1196, 1000000000L/10, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 30, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg49".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg49() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg49");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg49/IMG_20180911_120200_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg49/IMG_20180911_120200_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg49/IMG_20180911_120200_2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg49/IMG_20180911_120200_3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg49/IMG_20180911_120200_4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg49/IMG_20180911_120200_5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg49/IMG_20180911_120200_6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg49/IMG_20180911_120200_7.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg49_output.jpg", 1505, 1000000000L/10, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 30, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg50".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg50() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg50");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg50/IMG_20181015_144335_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg50/IMG_20181015_144335_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg50/IMG_20181015_144335_2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg50/IMG_20181015_144335_3.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg50_output.jpg", 114, 1000000000L/33, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ checkHistogramDetails(hdrHistogramDetails, 0, 91, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg51".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg51() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg51");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg51/IMG_20181025_182917_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg51/IMG_20181025_182917_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg51/IMG_20181025_182917_2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg51/IMG_20181025_182917_3.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg51/IMG_20181025_182917_4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg51/IMG_20181025_182917_5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg51/IMG_20181025_182917_6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg51/IMG_20181025_182917_7.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg51_output.jpg", 1600, 1000000000L/3, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ if( index == 1 ) {
+ int [] exp_offsets_x = {0, 8, 0};
+ int [] exp_offsets_y = {0, 4, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ assertEquals(0, activity.getApplicationInterface().getHDRProcessor().sharp_index);
+ }
+ else if( index == 7 ) {
+ int [] exp_offsets_x = {0, 60, 0};
+ int [] exp_offsets_y = {0, 28, 0};
+ TestUtils.checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, activity.getApplicationInterface().getHDRProcessor().getAvgSampleSize());
+ }
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 91, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvg52".
+ */
+ @Category(AvgTests.class)
+ @Test
+ public void testAvg52() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvg52");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvg52/IMG_20181119_144836_0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg52/IMG_20181119_144836_1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvg52/IMG_20181119_144836_2.jpg");
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvg52_output.jpg", 100, 1000000000L/297, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 0, 91, 255);
+ });
+ }
+
+ /** Tests Avg algorithm on test samples "testAvgtemp".
+ * Used for one-off testing, or to recreate NR images from the base exposures to test an updated alorithm.
+ * The test images should be copied to the test device into DCIM/testOpenCamera/testdata/hdrsamples/testAvgtemp/ .
+ */
+ @Test
+ public void testAvgtemp() throws IOException, InterruptedException {
+ Log.d(TAG, "testAvgtemp");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+ inputs.add(TestUtils.avg_images_path + "testAvgtemp/input0.png");
+ /*inputs.add(TestUtils.avg_images_path + "testAvgtemp/input0.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvgtemp/input1.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvgtemp/input2.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvgtemp/input3.jpg");*/
+ /*inputs.add(TestUtils.avg_images_path + "testAvgtemp/input4.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvgtemp/input5.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvgtemp/input6.jpg");
+ inputs.add(TestUtils.avg_images_path + "testAvgtemp/input7.jpg");*/
+
+ TestUtils.HistogramDetails hdrHistogramDetails = TestUtils.subTestAvg(activity,inputs, "testAvgtemp_output.jpg", 250, 1000000000L/33, 1.0f, new TestUtils.TestAvgCallback() {
+ @Override
+ public void doneProcessAvg(int index) {
+ Log.d(TAG, "doneProcessAvg: " + index);
+ }
+ });
+
+ //checkHistogramDetails(hdrHistogramDetails, 1, 39, 253);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanoramaWhite".
+ * This tests that auto-alignment fails gracefully if we can't find any matches.
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanoramaWhite() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanoramaWhite");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ inputs.add(TestUtils.panorama_images_path + "testPanoramaWhite/input0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanoramaWhite/input0.jpg");
+ float camera_angle_x = 66.3177f;
+ float camera_angle_y = 50.04736f;
+ float panorama_pics_per_screen = 2.0f;
+ String output_name = "testPanoramaWhite_output.jpg";
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, null, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 2.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama1".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama1() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama1");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ inputs.add(TestUtils.panorama_images_path + "testPanorama1/input0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama1/input1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama1/input2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama1/input3.jpg");
+ float camera_angle_x = 62.93796f;
+ float camera_angle_y = 47.44656f;
+ float panorama_pics_per_screen = 2.0f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (47.44656/49.56283);
+ String output_name = "testPanorama1_output.jpg";
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, null, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 2.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama2".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama2() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama2");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ /*final float panorama_pics_per_screen = 1.0f;
+ //inputs.add(TestUtils.panorama_images_path + "testPanorama2xxx/input0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama2xxx/input1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama2xxx/input2.jpg");*/
+ /*final float panorama_pics_per_screen = 2.0f;
+ //inputs.add(TestUtils.panorama_images_path + "testPanorama1/input0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama1/input1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama1/input2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama1/input3.jpg");
+ String output_name = "testPanorama1_output.jpg";*/
+ float panorama_pics_per_screen = 4.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama2/input0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama2/input1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama2/input2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama2/input3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama2/input4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama2/input5.jpg");
+ String output_name = "testPanorama2_output.jpg";
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (50.282097/52.26029);
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, null, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 2.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama3".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama3() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama3");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 4.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131249.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131252.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131255.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131258.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131301.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131303.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131305.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131307.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131315.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131317.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131320.jpg");
+ String output_name = "testPanorama3_output.jpg";
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (50.282097/52.26029);
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, null, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama3", with panorama_pics_per_screen set
+ * to 4.0.
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama3_picsperscreen2() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama3_picsperscreen2");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 2.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131249.jpg");
+ //inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131252.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131255.jpg");
+ //inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131258.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131301.jpg");
+ //inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131303.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131305.jpg");
+ //inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131307.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131315.jpg");
+ //inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131317.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama3/IMG_20190214_131320.jpg");
+ String output_name = "testPanorama3_picsperscreen2_output.jpg";
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (50.282097/52.26029);
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, null, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama4".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama4() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama4");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 4.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama4/IMG_20190222_225317_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama4/IMG_20190222_225317_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama4/IMG_20190222_225317_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama4/IMG_20190222_225317_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama4/IMG_20190222_225317_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama4/IMG_20190222_225317_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama4/IMG_20190222_225317_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama4/IMG_20190222_225317_7.jpg");
+ String output_name = "testPanorama4_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama4/IMG_20190222_225317.xml";
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (50.282097/52.26029);
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama5".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama5() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama5");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 4.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama5/IMG_20190223_220524_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama5/IMG_20190223_220524_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama5/IMG_20190223_220524_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama5/IMG_20190223_220524_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama5/IMG_20190223_220524_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama5/IMG_20190223_220524_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama5/IMG_20190223_220524_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama5/IMG_20190223_220524_7.jpg");
+ String output_name = "testPanorama5_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama5/IMG_20190223_220524.xml";
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (50.282097/52.26029);
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama6".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama6() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama6");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 4.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama6/IMG_20190225_154232_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama6/IMG_20190225_154232_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama6/IMG_20190225_154232_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama6/IMG_20190225_154232_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama6/IMG_20190225_154232_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama6/IMG_20190225_154232_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama6/IMG_20190225_154232_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama6/IMG_20190225_154232_7.jpg");
+ String output_name = "testPanorama6_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama6/IMG_20190225_154232.xml";
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (50.282097/52.26029);
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama7".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama7() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama7");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 4.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama7/IMG_20190225_155510_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama7/IMG_20190225_155510_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama7/IMG_20190225_155510_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama7/IMG_20190225_155510_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama7/IMG_20190225_155510_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama7/IMG_20190225_155510_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama7/IMG_20190225_155510_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama7/IMG_20190225_155510_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama7/IMG_20190225_155510_8.jpg");
+ String output_name = "testPanorama7_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama7/IMG_20190225_155510.xml";
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (50.282097/52.26029);
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama8".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama8() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama8");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 2.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama8/IMG_20190227_001431_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama8/IMG_20190227_001431_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama8/IMG_20190227_001431_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama8/IMG_20190227_001431_3.jpg");
+ String output_name = "testPanorama8_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama8/IMG_20190227_001431.xml";
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (50.282097/52.26029);
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama9".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama9() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama9");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama9/IMG_20190301_145213_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama9/IMG_20190301_145213_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama9/IMG_20190301_145213_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama9/IMG_20190301_145213_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama9/IMG_20190301_145213_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama9/IMG_20190301_145213_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama9/IMG_20190301_145213_6.jpg");
+ String output_name = "testPanorama9_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama9/IMG_20190301_145213.xml";
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (50.282097/50.44399);
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+
+ try {
+ Thread.sleep(1000); // need to wait for debug images to be saved/broadcast?
+ }
+ catch(InterruptedException e) {
+ e.printStackTrace();
+ }
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama10".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama10() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama10");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_9.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_10.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_11.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948_12.jpg");
+ String output_name = "testPanorama10_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama10/IMG_20190301_144948.xml";
+ //gyro_name = null;
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (50.282097/50.44399);
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama11".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama11() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama11");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama11/IMG_20190306_143652_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama11/IMG_20190306_143652_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama11/IMG_20190306_143652_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama11/IMG_20190306_143652_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama11/IMG_20190306_143652_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama11/IMG_20190306_143652_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama11/IMG_20190306_143652_6.jpg");
+ String output_name = "testPanorama11_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama11/IMG_20190306_143652.xml";
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (50.282097/50.44399);
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama12".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama12() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama12");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama12/IMG_20190308_152008_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama12/IMG_20190308_152008_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama12/IMG_20190308_152008_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama12/IMG_20190308_152008_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama12/IMG_20190308_152008_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama12/IMG_20190308_152008_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama12/IMG_20190308_152008_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama12/IMG_20190308_152008_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama12/IMG_20190308_152008_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama12/IMG_20190308_152008_9.jpg");
+ String output_name = "testPanorama12_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama12/IMG_20190308_152008.xml";
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+ // these images were taken with incorrect camera view angles, so we compensate in the test:
+ panorama_pics_per_screen *= (50.282097/50.44399);
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama13".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama13() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama13");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama13/IMG_20190512_014152_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama13/IMG_20190512_014152_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama13/IMG_20190512_014152_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama13/IMG_20190512_014152_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama13/IMG_20190512_014152_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama13/IMG_20190512_014152_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama13/IMG_20190512_014152_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama13/IMG_20190512_014152_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama13/IMG_20190512_014152_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama13/IMG_20190512_014152_9.jpg");
+ String output_name = "testPanorama13_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama13/IMG_20190512_014152.xml";
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama14".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama14() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama14");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama14/IMG_20190513_151249_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama14/IMG_20190513_151249_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama14/IMG_20190513_151249_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama14/IMG_20190513_151249_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama14/IMG_20190513_151249_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama14/IMG_20190513_151249_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama14/IMG_20190513_151249_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama14/IMG_20190513_151249_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama14/IMG_20190513_151249_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama14/IMG_20190513_151249_9.jpg");
+ String output_name = "testPanorama14_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama14/IMG_20190513_151249.xml";
+ //gyro_name = null;
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama15".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama15() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama15");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama15/IMG_20190513_151624_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama15/IMG_20190513_151624_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama15/IMG_20190513_151624_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama15/IMG_20190513_151624_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama15/IMG_20190513_151624_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama15/IMG_20190513_151624_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama15/IMG_20190513_151624_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama15/IMG_20190513_151624_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama15/IMG_20190513_151624_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama15/IMG_20190513_151624_9.jpg");
+ String output_name = "testPanorama15_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama15/IMG_20190513_151624.xml";
+ //gyro_name = null;
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama16".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama16() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama16");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama16/IMG_20190624_151731_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama16/IMG_20190624_151731_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama16/IMG_20190624_151731_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama16/IMG_20190624_151731_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama16/IMG_20190624_151731_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama16/IMG_20190624_151731_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama16/IMG_20190624_151731_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama16/IMG_20190624_151731_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama16/IMG_20190624_151731_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama16/IMG_20190624_151731_9.jpg");
+ String output_name = "testPanorama16_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama16/IMG_20190624_151731.xml";
+ //gyro_name = null;
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama17".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama17() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama17");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama17/IMG_20190625_135423_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama17/IMG_20190625_135423_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama17/IMG_20190625_135423_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama17/IMG_20190625_135423_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama17/IMG_20190625_135423_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama17/IMG_20190625_135423_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama17/IMG_20190625_135423_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama17/IMG_20190625_135423_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama17/IMG_20190625_135423_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama17/IMG_20190625_135423_9.jpg");
+ String output_name = "testPanorama17_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama17/IMG_20190625_135423.xml";
+ //gyro_name = null;
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama18".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama18() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama18");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama18/IMG_20190626_152559_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama18/IMG_20190626_152559_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama18/IMG_20190626_152559_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama18/IMG_20190626_152559_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama18/IMG_20190626_152559_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama18/IMG_20190626_152559_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama18/IMG_20190626_152559_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama18/IMG_20190626_152559_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama18/IMG_20190626_152559_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama18/IMG_20190626_152559_9.jpg");
+ String output_name = "testPanorama18_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama18/IMG_20190626_152559.xml";
+ //gyro_name = null;
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama19".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama19() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama19");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama19/IMG_20190627_134059_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama19/IMG_20190627_134059_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama19/IMG_20190627_134059_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama19/IMG_20190627_134059_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama19/IMG_20190627_134059_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama19/IMG_20190627_134059_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama19/IMG_20190627_134059_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama19/IMG_20190627_134059_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama19/IMG_20190627_134059_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama19/IMG_20190627_134059_9.jpg");
+ String output_name = "testPanorama19_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama19/IMG_20190627_134059.xml";
+ //gyro_name = null;
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama20".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama20() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama20");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama20/IMG_20190628_145027_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama20/IMG_20190628_145027_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama20/IMG_20190628_145027_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama20/IMG_20190628_145027_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama20/IMG_20190628_145027_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama20/IMG_20190628_145027_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama20/IMG_20190628_145027_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama20/IMG_20190628_145027_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama20/IMG_20190628_145027_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama20/IMG_20190628_145027_9.jpg");
+ String output_name = "testPanorama20_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama20/IMG_20190628_145027.xml";
+ //gyro_name = null;
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama21".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama21() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama21");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama21/IMG_20190628_145552_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama21/IMG_20190628_145552_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama21/IMG_20190628_145552_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama21/IMG_20190628_145552_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama21/IMG_20190628_145552_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama21/IMG_20190628_145552_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama21/IMG_20190628_145552_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama21/IMG_20190628_145552_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama21/IMG_20190628_145552_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama21/IMG_20190628_145552_9.jpg");
+ String output_name = "testPanorama21_output.jpg";
+ String gyro_name = TestUtils.panorama_images_path + "testPanorama21/IMG_20190628_145552.xml";
+ //gyro_name = null;
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 0.5f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama22".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama22() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama22");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama22/IMG_20190629_165627_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama22/IMG_20190629_165627_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama22/IMG_20190629_165627_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama22/IMG_20190629_165627_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama22/IMG_20190629_165627_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama22/IMG_20190629_165627_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama22/IMG_20190629_165627_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama22/IMG_20190629_165627_7.jpg");
+ String output_name = "testPanorama22_output.jpg";
+ String gyro_name = null;
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama23".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama23() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama23");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama23/IMG_20190702_145916_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama23/IMG_20190702_145916_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama23/IMG_20190702_145916_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama23/IMG_20190702_145916_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama23/IMG_20190702_145916_4.jpg");
+ String output_name = "testPanorama23_output.jpg";
+ String gyro_name = null;
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama24".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama24() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama24");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama24/IMG_20190703_154333_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama24/IMG_20190703_154333_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama24/IMG_20190703_154333_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama24/IMG_20190703_154333_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama24/IMG_20190703_154333_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama24/IMG_20190703_154333_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama24/IMG_20190703_154333_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama24/IMG_20190703_154333_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama24/IMG_20190703_154333_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama24/IMG_20190703_154333_9.jpg");
+ String output_name = "testPanorama24_output.jpg";
+ String gyro_name = null;
+ // taken with OnePlus 3T, Camera2 API:
+ float camera_angle_x = 62.93796f;
+ float camera_angle_y = 47.44656f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama25".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama25() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama25");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ //float panorama_pics_per_screen = 3.33333f / 2.0f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama25/IMG_20190706_215940_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama25/IMG_20190706_215940_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama25/IMG_20190706_215940_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama25/IMG_20190706_215940_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama25/IMG_20190706_215940_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama25/IMG_20190706_215940_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama25/IMG_20190706_215940_6.jpg");
+ String output_name = "testPanorama25_output.jpg";
+ String gyro_name = null;
+ // taken with Nokia 8, Camera2 API:
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama26".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama26() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama26");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama26/IMG_20190706_214842_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama26/IMG_20190706_214842_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama26/IMG_20190706_214842_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama26/IMG_20190706_214842_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama26/IMG_20190706_214842_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama26/IMG_20190706_214842_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama26/IMG_20190706_214842_6.jpg");
+ String output_name = "testPanorama26_output.jpg";
+ String gyro_name = null;
+ // taken with Nokia 8, Camera2 API:
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama27".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama27() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama27");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama27/IMG_20190706_192120_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama27/IMG_20190706_192120_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama27/IMG_20190706_192120_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama27/IMG_20190706_192120_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama27/IMG_20190706_192120_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama27/IMG_20190706_192120_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama27/IMG_20190706_192120_6.jpg");
+ String output_name = "testPanorama27_output.jpg";
+ String gyro_name = null;
+ // taken with Nokia 8, Camera2 API:
+ float camera_angle_x = 66.708595f;
+ float camera_angle_y = 50.282097f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama28".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama28() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama28");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ // right-to-left:
+ /*inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_9.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_0.jpg");*/
+ // converted from original JPEGs to PNG using Nokia 8:
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/input_bitmap_0.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/input_bitmap_1.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/input_bitmap_2.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/input_bitmap_3.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/input_bitmap_4.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/input_bitmap_5.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/input_bitmap_6.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/input_bitmap_7.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/input_bitmap_8.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/input_bitmap_9.png");
+ String output_name = "testPanorama28_output.jpg";
+ String gyro_name = null;
+ // taken with Samsung Galaxy S10e, Camera2 API, standard rear camera:
+ float camera_angle_x = 66.3177f;
+ float camera_angle_y = 50.04736f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama28", but with a nbnq similar set of
+ * input images. Instead of converting the original JPEGs to PNG on Nokia 8, this was done on
+ * the Samsung Galaxy S10e, which gives small differences, but enough to show up potential
+ * stability issues.
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama28_galaxys10e() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama28_galaxys10e");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ // right-to-left:
+ /*inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_9.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/IMG_20190725_134756_0.jpg");*/
+ // converted from original JPEGs to PNG using Samsung Galaxy S10e:
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/galaxys10e_input_bitmap_0.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/galaxys10e_input_bitmap_1.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/galaxys10e_input_bitmap_2.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/galaxys10e_input_bitmap_3.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/galaxys10e_input_bitmap_4.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/galaxys10e_input_bitmap_5.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/galaxys10e_input_bitmap_6.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/galaxys10e_input_bitmap_7.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/galaxys10e_input_bitmap_8.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama28/galaxys10e_input_bitmap_9.png");
+ String output_name = "testPanorama28_galaxys10e_output.jpg";
+ String gyro_name = null;
+ // taken with Samsung Galaxy S10e, Camera2 API, standard rear camera:
+ float camera_angle_x = 66.3177f;
+ float camera_angle_y = 50.04736f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama29".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama29() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama29");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ // right-to-left:
+ inputs.add(TestUtils.panorama_images_path + "testPanorama29/IMG_20190719_145852_9.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama29/IMG_20190719_145852_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama29/IMG_20190719_145852_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama29/IMG_20190719_145852_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama29/IMG_20190719_145852_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama29/IMG_20190719_145852_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama29/IMG_20190719_145852_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama29/IMG_20190719_145852_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama29/IMG_20190719_145852_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama29/IMG_20190719_145852_0.jpg");
+ String output_name = "testPanorama29_output.jpg";
+ String gyro_name = null;
+ // taken with Nokia 8, old API:
+ float camera_angle_x = 66.1062f;
+ float camera_angle_y = 49.88347f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama30".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama30() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama30");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ /*inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_9.jpg");*/
+ // converted from original JPEGs to PNG using Nokia 8:
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/nokia8_input_bitmap_0.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/nokia8_input_bitmap_1.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/nokia8_input_bitmap_2.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/nokia8_input_bitmap_3.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/nokia8_input_bitmap_4.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/nokia8_input_bitmap_5.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/nokia8_input_bitmap_6.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/nokia8_input_bitmap_7.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/nokia8_input_bitmap_8.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/nokia8_input_bitmap_9.png");
+ String output_name = "testPanorama30_output.jpg";
+ String gyro_name = null;
+ // taken with Samsung Galaxy S10e, old API, standard rear camera:
+ // n.b., camera angles are indeed the exact same as with Camera2
+ float camera_angle_x = 66.3177f;
+ float camera_angle_y = 50.04736f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama30", but with a nbnq similar set of
+ * input images. Instead of converting the original JPEGs to PNG on Nokia 8, this was done on
+ * the Samsung Galaxy S10e, which gives small differences, but enough to show up potential
+ * stability issues.
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama30_galaxys10e() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama30_galaxys10e");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ /*inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/IMG_20190723_142934_9.jpg");*/
+ // converted from original JPEGs to PNG using Samsung Galaxy S10e:
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/galaxys10e_input_bitmap_0.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/galaxys10e_input_bitmap_1.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/galaxys10e_input_bitmap_2.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/galaxys10e_input_bitmap_3.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/galaxys10e_input_bitmap_4.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/galaxys10e_input_bitmap_5.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/galaxys10e_input_bitmap_6.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/galaxys10e_input_bitmap_7.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/galaxys10e_input_bitmap_8.png");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama30/galaxys10e_input_bitmap_9.png");
+ String output_name = "testPanorama30_galaxys10e_output.jpg";
+ String gyro_name = null;
+ // taken with Samsung Galaxy S10e, old API, standard rear camera:
+ // n.b., camera angles are indeed the exact same as with Camera2
+ float camera_angle_x = 66.3177f;
+ float camera_angle_y = 50.04736f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama31".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama31() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama31");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama31/IMG_20190704_135633_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama31/IMG_20190704_135633_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama31/IMG_20190704_135633_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama31/IMG_20190704_135633_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama31/IMG_20190704_135633_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama31/IMG_20190704_135633_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama31/IMG_20190704_135633_6.jpg");
+ String output_name = "testPanorama31_output.jpg";
+ String gyro_name = null;
+ // taken with OnePlus 3T, Camera2 API:
+ float camera_angle_x = 62.93796f;
+ float camera_angle_y = 47.44656f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama3".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama32() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama32");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama32/IMG_20190705_145938_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama32/IMG_20190705_145938_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama32/IMG_20190705_145938_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama32/IMG_20190705_145938_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama32/IMG_20190705_145938_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama32/IMG_20190705_145938_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama32/IMG_20190705_145938_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama32/IMG_20190705_145938_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama32/IMG_20190705_145938_8.jpg");
+ String output_name = "testPanorama32_output.jpg";
+ String gyro_name = null;
+ // taken with OnePlus 3T, old API:
+ float camera_angle_x = 60.0f;
+ float camera_angle_y = 45.0f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama33".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama33() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama33");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama33/IMG_20190713_013437_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama33/IMG_20190713_013437_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama33/IMG_20190713_013437_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama33/IMG_20190713_013437_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama33/IMG_20190713_013437_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama33/IMG_20190713_013437_5.jpg");
+ String output_name = "testPanorama33_output.jpg";
+ String gyro_name = null;
+ // taken with Nokia 8, old API:
+ float camera_angle_x = 66.1062f;
+ float camera_angle_y = 49.88347f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama34".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama34() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama34");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ // right-to-left:
+ inputs.add(TestUtils.panorama_images_path + "testPanorama34/IMG_20190717_144042_9.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama34/IMG_20190717_144042_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama34/IMG_20190717_144042_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama34/IMG_20190717_144042_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama34/IMG_20190717_144042_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama34/IMG_20190717_144042_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama34/IMG_20190717_144042_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama34/IMG_20190717_144042_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama34/IMG_20190717_144042_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama34/IMG_20190717_144042_0.jpg");
+ String output_name = "testPanorama34_output.jpg";
+ String gyro_name = null;
+ // taken with Nexus 6, old API:
+ float camera_angle_x = 62.7533f;
+ float camera_angle_y = 47.298824f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama35".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama35() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama35");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama35/IMG_20190717_145114_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama35/IMG_20190717_145114_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama35/IMG_20190717_145114_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama35/IMG_20190717_145114_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama35/IMG_20190717_145114_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama35/IMG_20190717_145114_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama35/IMG_20190717_145114_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama35/IMG_20190717_145114_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama35/IMG_20190717_145114_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama35/IMG_20190717_145114_9.jpg");
+ String output_name = "testPanorama35_output.jpg";
+ String gyro_name = null;
+ // taken with Nexus 7, old API:
+ float camera_angle_x = 55.0f;
+ float camera_angle_y = 41.401073f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama36".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama36() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama36");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama36/IMG_20190722_201331_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama36/IMG_20190722_201331_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama36/IMG_20190722_201331_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama36/IMG_20190722_201331_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama36/IMG_20190722_201331_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama36/IMG_20190722_201331_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama36/IMG_20190722_201331_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama36/IMG_20190722_201331_7.jpg");
+ String output_name = "testPanorama36_output.jpg";
+ String gyro_name = null;
+ // taken with Samsung Galaxy S10e, Camera2 API, ultra wide rear camera:
+ float camera_angle_x = 104.00253f;
+ float camera_angle_y = 81.008804f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama37".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama37() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama37");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama37/IMG_20190723_203441_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama37/IMG_20190723_203441_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama37/IMG_20190723_203441_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama37/IMG_20190723_203441_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama37/IMG_20190723_203441_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama37/IMG_20190723_203441_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama37/IMG_20190723_203441_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama37/IMG_20190723_203441_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama37/IMG_20190723_203441_8.jpg");
+ String output_name = "testPanorama37_output.jpg";
+ String gyro_name = null;
+ // taken with Samsung Galaxy S10e, old API, standard rear camera:
+ // n.b., camera angles are indeed the exact same as with Camera2
+ float camera_angle_x = 66.3177f;
+ float camera_angle_y = 50.04736f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ /** Tests panorama algorithm on test samples "testPanorama38".
+ */
+ @Category(PanoramaTests.class)
+ @Test
+ public void testPanorama38() throws IOException, InterruptedException {
+ Log.d(TAG, "testPanorama38");
+
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> { // for simplicity, run the entire test on the UI thread
+ // list assets
+ List inputs = new ArrayList<>();
+
+ float panorama_pics_per_screen = 3.33333f;
+ inputs.add(TestUtils.panorama_images_path + "testPanorama38/IMG_20190722_141148_0.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama38/IMG_20190722_141148_1.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama38/IMG_20190722_141148_2.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama38/IMG_20190722_141148_3.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama38/IMG_20190722_141148_4.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama38/IMG_20190722_141148_5.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama38/IMG_20190722_141148_6.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama38/IMG_20190722_141148_7.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama38/IMG_20190722_141148_8.jpg");
+ inputs.add(TestUtils.panorama_images_path + "testPanorama38/IMG_20190722_141148_9.jpg");
+ String output_name = "testPanorama38_output.jpg";
+ String gyro_name = null;
+ // taken with Samsung Galaxy S10e, Camera2 API, standard rear camera:
+ float camera_angle_x = 66.3177f;
+ float camera_angle_y = 50.04736f;
+
+ TestUtils.subTestPanorama(activity, inputs, output_name, gyro_name, panorama_pics_per_screen, camera_angle_x, camera_angle_y, 1.0f);
+ });
+ }
+
+ private void waitForTakePhoto() {
+ Log.d(TAG, "wait until finished taking photo");
+ long time_s = System.currentTimeMillis();
+ while(true) {
+ boolean waiting = getActivityValue(activity -> (activity.getPreview().isTakingPhoto() || !activity.getApplicationInterface().canTakeNewPhoto()));
+ if( !waiting ) {
+ break;
+ }
+ mActivityRule.getScenario().onActivity(activity -> {
+ TestUtils.waitForTakePhotoChecks(activity, time_s);
+ });
+ }
+
+ Log.d(TAG, "done taking photo");
+ }
+
+ private void subTestTouchToFocus(final boolean wait_after_focus, final boolean single_tap_photo, final boolean double_tap_photo, final boolean manual_can_auto_focus, final boolean can_focus_area, final String focus_value, final String focus_value_ui) throws InterruptedException {
+ // touch to auto-focus with focus area (will also exit immersive mode)
+ // autofocus shouldn't be immediately, but after a delay
+ // and Galaxy S10e needs a longer delay for some reason, for the subsequent touch of the preview view to register
+ Thread.sleep(2000);
+ int saved_count = getActivityValue(activity -> activity.getPreview().count_cameraAutoFocus);
+ Log.d(TAG, "saved count_cameraAutoFocus: " + saved_count);
+ Log.d(TAG, "### about to click preview for autofocus");
+
+ onView(anyOf(ViewMatchers.withClassName(endsWith("MySurfaceView")), ViewMatchers.withClassName(endsWith("MyTextureView")))).perform(click());
+
+ Log.d(TAG, "### done click preview for autofocus");
+
+ mActivityRule.getScenario().onActivity(activity -> {
+ TestUtils.touchToFocusChecks(activity, single_tap_photo, double_tap_photo, manual_can_auto_focus, can_focus_area, focus_value, focus_value_ui, saved_count);
+ });
+
+ if( double_tap_photo ) {
+ Thread.sleep(100);
+ Log.d(TAG, "about to click preview again for double tap");
+ //onView(withId(preview_view_id)).perform(ViewActions.doubleClick());
+ mActivityRule.getScenario().onActivity(activity -> {
+ //onView(anyOf(ViewMatchers.withClassName(endsWith("MySurfaceView")), ViewMatchers.withClassName(endsWith("MyTextureView")))).perform(click());
+ activity.getPreview().onDoubleTap(); // calling tapView twice doesn't seem to work consistently, so we call this directly!
+ });
+ }
+ if( wait_after_focus && !single_tap_photo && !double_tap_photo) {
+ // don't wait after single or double tap photo taking, as the photo taking operation is already started
+ Log.d(TAG, "wait after focus...");
+ Thread.sleep(3000);
+ }
+ }
+
+ private void subTestTakePhoto(boolean locked_focus, boolean immersive_mode, boolean touch_to_focus, boolean wait_after_focus, boolean single_tap_photo, boolean double_tap_photo, boolean is_raw, boolean test_wait_capture_result) throws InterruptedException {
+ Thread.sleep(500);
+
+ TestUtils.SubTestTakePhotoInfo info = getActivityValue(activity -> TestUtils.getSubTestTakePhotoInfo(activity, immersive_mode, single_tap_photo, double_tap_photo));
+
+ int saved_count_cameraTakePicture = getActivityValue(activity -> activity.getPreview().count_cameraTakePicture);
+
+ // count initial files in folder
+ String [] files = getActivityValue(activity -> TestUtils.filesInSaveFolder(activity));
+ int n_files = files == null ? 0 : files.length;
+ Log.d(TAG, "n_files at start: " + n_files);
+
+ int saved_count = getActivityValue(activity -> activity.getPreview().count_cameraAutoFocus);
+
+ int saved_thumbnail_count = getActivityValue(activity -> activity.getApplicationInterface().getDrawPreview().test_thumbnail_anim_count);
+ Log.d(TAG, "saved_thumbnail_count: " + saved_thumbnail_count);
+
+ if( touch_to_focus ) {
+ subTestTouchToFocus(wait_after_focus, single_tap_photo, double_tap_photo, info.manual_can_auto_focus, info.can_focus_area, info.focus_value, info.focus_value_ui);
+ }
+ Log.d(TAG, "saved count_cameraAutoFocus: " + saved_count);
+
+ if( !single_tap_photo && !double_tap_photo ) {
+ mActivityRule.getScenario().onActivity(activity -> {
+ View takePhotoButton = activity.findViewById(net.sourceforge.opencamera.R.id.take_photo);
+ assertFalse( activity.hasThumbnailAnimation() );
+ Log.d(TAG, "about to click take photo");
+ clickView(takePhotoButton);
+ Log.d(TAG, "done clicking take photo");
+ });
+ }
+
+ waitForTakePhoto();
+
+ int new_count_cameraTakePicture = getActivityValue(activity -> activity.getPreview().count_cameraTakePicture);
+ Log.d(TAG, "take picture count: " + new_count_cameraTakePicture);
+ assertEquals(new_count_cameraTakePicture, saved_count_cameraTakePicture + 1);
+
+ /*if( test_wait_capture_result ) {
+ // if test_wait_capture_result, then we'll have waited too long for thumbnail animation
+ }
+ else if( info.is_focus_bracketing ) {
+ // thumbnail animation may have already occurred (e.g., see testTakePhotoFocusBracketingHeavy()
+ }
+ else*/ if( info.has_thumbnail_anim ) {
+ long time_s = System.currentTimeMillis();
+ for(;;) {
+ //boolean waiting = getActivityValue(activity -> !activity.hasThumbnailAnimation());
+ boolean waiting = getActivityValue(activity -> (activity.getApplicationInterface().getDrawPreview().test_thumbnail_anim_count <= saved_thumbnail_count));
+ if( !waiting ) {
+ break;
+ }
+ Log.d(TAG, "waiting for thumbnail animation");
+ Thread.sleep(10);
+ int allowed_time_ms = 10000;
+ if( info.is_hdr || info.is_nr || info.is_expo ) {
+ // some devices need longer time (especially Nexus 6)
+ allowed_time_ms = 16000;
+ }
+ assertTrue( System.currentTimeMillis() - time_s < allowed_time_ms );
+ }
+ }
+ else {
+ boolean has_thumbnail_animation = getActivityValue(activity -> activity.hasThumbnailAnimation());
+ assertFalse( has_thumbnail_animation );
+ int new_thumbnail_count = getActivityValue(activity -> activity.getApplicationInterface().getDrawPreview().test_thumbnail_anim_count);
+ assertEquals(saved_thumbnail_count, new_thumbnail_count);
+ }
+
+ mActivityRule.getScenario().onActivity(activity -> {
+ activity.waitUntilImageQueueEmpty();
+
+ TestUtils.checkFocusAfterTakePhoto(activity, info.focus_value, info.focus_value_ui);
+
+ try {
+ TestUtils.checkFilesAfterTakePhoto(activity, is_raw, test_wait_capture_result, files);
+ }
+ catch(InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ TestUtils.checkFocusAfterTakePhoto2(activity, touch_to_focus, single_tap_photo, double_tap_photo, test_wait_capture_result, locked_focus, info.can_auto_focus, info.can_focus_area, saved_count);
+
+ TestUtils.postTakePhotoChecks(activity, immersive_mode, info.exposureVisibility, info.exposureLockVisibility);
+
+ assertFalse(activity.getApplicationInterface().getImageSaver().test_queue_blocked);
+ assertTrue( activity.getPreview().getCameraController() == null || activity.getPreview().getCameraController().count_camera_parameters_exception == 0 );
+ });
+
+ }
+
+ /*@Category(PhotoTests.class)
+ @Test
+ public void testTakePhoto() throws InterruptedException {
+ Log.d(TAG, "testTakePhoto");
+ setToDefault();
+ subTestTakePhoto(false, false, true, true, false, false, false, false);
+ }*/
+
+ /** Tests option to remove device exif info.
+ */
+ @Category(PhotoTests.class)
+ @Test
+ public void testTakePhotoRemoveExifOn() throws InterruptedException {
+ Log.d(TAG, "testTakePhotoRemoveExifOn");
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> {
+ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(activity);
+ SharedPreferences.Editor editor = settings.edit();
+ editor.putString(PreferenceKeys.RemoveDeviceExifPreferenceKey, "preference_remove_device_exif_on");
+ editor.apply();
+ updateForSettings(activity);
+ });
+
+ subTestTakePhoto(false, false, true, true, false, false, false, false);
+
+ mActivityRule.getScenario().onActivity(activity -> {
+ try {
+ TestUtils.testExif(activity, activity.test_last_saved_image, activity.test_last_saved_imageuri, false, false, false);
+ }
+ catch(IOException e) {
+ e.printStackTrace();
+ fail();
+ }
+ });
+ }
+
+ /** Tests option to remove device exif info, but with auto-level to test codepath where we
+ * resave the bitmap.
+ */
+ @Category(PhotoTests.class)
+ @Test
+ public void testTakePhotoRemoveExifOn2() throws InterruptedException {
+ Log.d(TAG, "testTakePhotoRemoveExifOn2");
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> {
+ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(activity);
+ SharedPreferences.Editor editor = settings.edit();
+ editor.putString(PreferenceKeys.RemoveDeviceExifPreferenceKey, "preference_remove_device_exif_on");
+ editor.putBoolean(PreferenceKeys.AutoStabilisePreferenceKey, true);
+ editor.apply();
+ updateForSettings(activity);
+ });
+
+ subTestTakePhoto(false, false, true, true, false, false, false, false);
+
+ mActivityRule.getScenario().onActivity(activity -> {
+ try {
+ TestUtils.testExif(activity, activity.test_last_saved_image, activity.test_last_saved_imageuri, false, false, false);
+ }
+ catch(IOException e) {
+ e.printStackTrace();
+ fail();
+ }
+ });
+ }
+ /** Tests option to remove device exif info, but keeping datetime tags.
+ */
+ @Category(PhotoTests.class)
+ @Test
+ public void testTakePhotoRemoveExifKeepDatetime() throws InterruptedException {
+ Log.d(TAG, "testTakePhotoRemoveExifKeepDatetime");
+ setToDefault();
+
+ mActivityRule.getScenario().onActivity(activity -> {
+ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(activity);
+ SharedPreferences.Editor editor = settings.edit();
+ editor.putString(PreferenceKeys.RemoveDeviceExifPreferenceKey, "preference_remove_device_exif_keep_datetime");
+ editor.apply();
+ updateForSettings(activity);
+ });
+
+ subTestTakePhoto(false, false, true, true, false, false, false, false);
+
+ mActivityRule.getScenario().onActivity(activity -> {
+ try {
+ TestUtils.testExif(activity, activity.test_last_saved_image, activity.test_last_saved_imageuri, false, true, false);
+ }
+ catch(IOException e) {
+ e.printStackTrace();
+ fail();
+ }
+ });
+ }
+}
diff --git a/app/src/androidTest/java/net/sourceforge/opencamera/PanoramaTestSuite.java b/app/src/androidTest/java/net/sourceforge/opencamera/PanoramaTestSuite.java
new file mode 100644
index 0000000000000000000000000000000000000000..84186f7837bb175eef55a970b64162211fffb9a0
--- /dev/null
+++ b/app/src/androidTest/java/net/sourceforge/opencamera/PanoramaTestSuite.java
@@ -0,0 +1,17 @@
+package net.sourceforge.opencamera;
+
+import org.junit.experimental.categories.Categories;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/** Tests for Panorama algorithm - only need to run on a single device
+ * Should manually look over the images dumped onto DCIM/
+ * To use these tests, the testdata/ subfolder should be manually copied to the test device in the DCIM/testOpenCamera/
+ * folder (so you have DCIM/testOpenCamera/testdata/). We don't use assets/ as we'd end up with huge APK sizes which takes
+ * time to transfer to the device every time we run the tests.
+ * On Android 10+, scoped storage permission needs to be given to Open Camera for the DCIM/testOpenCamera/ folder.
+ */
+@RunWith(Categories.class)
+@Categories.IncludeCategory(PanoramaTests.class)
+@Suite.SuiteClasses({InstrumentedTest.class})
+public class PanoramaTestSuite {}
diff --git a/app/src/androidTest/java/net/sourceforge/opencamera/PhotoTestSuite.java b/app/src/androidTest/java/net/sourceforge/opencamera/PhotoTestSuite.java
new file mode 100644
index 0000000000000000000000000000000000000000..05a311294a9ed43fb490d86c570deec47f5ac153
--- /dev/null
+++ b/app/src/androidTest/java/net/sourceforge/opencamera/PhotoTestSuite.java
@@ -0,0 +1,13 @@
+package net.sourceforge.opencamera;
+
+import org.junit.experimental.categories.Categories;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/** Tests related to taking photos; note that tests to do with photo mode that don't take photos are still part of MainTests.
+ */
+
+@RunWith(Categories.class)
+@Categories.IncludeCategory(PhotoTests.class)
+@Suite.SuiteClasses({InstrumentedTest.class})
+public class PhotoTestSuite {}
diff --git a/app/src/androidTest/java/net/sourceforge/opencamera/TestUtils.java b/app/src/androidTest/java/net/sourceforge/opencamera/TestUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..92c980f52345bd0bfb1a9bdfb50d92c71e5bb9b1
--- /dev/null
+++ b/app/src/androidTest/java/net/sourceforge/opencamera/TestUtils.java
@@ -0,0 +1,1478 @@
+package net.sourceforge.opencamera;
+
+import static org.junit.Assert.*;
+
+import android.annotation.TargetApi;
+import android.content.ContentUris;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Matrix;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Environment;
+import android.os.ParcelFileDescriptor;
+import android.preference.PreferenceManager;
+import android.provider.DocumentsContract;
+import android.provider.MediaStore;
+import android.renderscript.Allocation;
+import android.util.Log;
+import android.view.View;
+
+import androidx.annotation.RequiresApi;
+import androidx.exifinterface.media.ExifInterface;
+
+import net.sourceforge.opencamera.preview.Preview;
+
+import java.io.File;
+import java.io.FileDescriptor;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+/** Helper class for testing. This method should not include any code specific to any test framework
+ * (e.g., shouldn't be specific to ActivityInstrumentationTestCase2).
+ */
+public class TestUtils {
+ private static final String TAG = "TestUtils";
+
+ final private static String images_base_path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath();
+ final public static String hdr_images_path = images_base_path + "/testOpenCamera/testdata/hdrsamples/";
+ final public static String avg_images_path = images_base_path + "/testOpenCamera/testdata/avgsamples/";
+ final public static String logprofile_images_path = images_base_path + "/testOpenCamera/testdata/logprofilesamples/";
+ final public static String panorama_images_path = images_base_path + "/testOpenCamera/testdata/panoramasamples/";
+
+ public static void setDefaultIntent(Intent intent) {
+ intent.putExtra("test_project", true);
+ }
+
+ /** Code to call before running each test.
+ */
+ public static void initTest(Context context, boolean test_camera2) {
+ Log.d(TAG, "initTest: " + test_camera2);
+ // initialise test statics (to avoid the persisting between tests in a test suite run!)
+ MainActivity.test_preview_want_no_limits = false;
+ MainActivity.test_preview_want_no_limits_value = false;
+ ImageSaver.test_small_queue_size = false;
+
+ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
+ SharedPreferences.Editor editor = settings.edit();
+ editor.clear();
+ if( test_camera2 ) {
+ MainActivity.test_force_supports_camera2 = true;
+ //editor.putBoolean(PreferenceKeys.UseCamera2PreferenceKey, true);
+ editor.putString(PreferenceKeys.CameraAPIPreferenceKey, "preference_camera_api_camera2");
+ }
+ editor.apply();
+
+ Log.d(TAG, "initTest: done");
+ }
+
+ public static boolean isEmulator() {
+ return Build.MODEL.contains("Android SDK built for x86");
+ }
+
+ /** Converts a path to a Uri for com.android.providers.media.documents.
+ */
+ private static Uri getDocumentUri(String filename) throws FileNotFoundException {
+ Log.d(TAG, "getDocumentUri: " + filename);
+
+ // convert from File path format to Storage Access Framework form
+ Uri treeUri = Uri.parse("content://com.android.externalstorage.documents/tree/primary%3ADCIM%2FtestOpenCamera");
+ Log.d(TAG, "treeUri: " + treeUri);
+ if( !filename.startsWith(images_base_path) ) {
+ Log.e(TAG, "unknown base for: " + filename);
+ throw new FileNotFoundException();
+ }
+ String stem = filename.substring(images_base_path.length());
+ Uri stemUri = Uri.parse("content://com.android.externalstorage.documents/tree/primary%3ADCIM" + stem.replace("/", "%2F"));
+ Log.d(TAG, "stem: " + stem);
+ Log.d(TAG, "stemUri: " + stemUri);
+ //String docID = "primary:DCIM" + stem;
+ String docID = DocumentsContract.getTreeDocumentId(stemUri);
+ Log.d(TAG, "docID: " + docID);
+ Uri uri = DocumentsContract.buildDocumentUriUsingTree(treeUri, docID);
+
+ if( uri == null ) {
+ throw new FileNotFoundException();
+ }
+ return uri;
+ }
+
+ public static Bitmap getBitmapFromFile(MainActivity activity, String filename) {
+ return getBitmapFromFile(activity, filename, 1);
+ }
+
+ public static Bitmap getBitmapFromFile(MainActivity activity, String filename, int inSampleSize) {
+ try {
+ return getBitmapFromFileCore(activity, filename, inSampleSize);
+ }
+ catch(FileNotFoundException e) {
+ e.printStackTrace();
+ fail("FileNotFoundException loading: " + filename);
+ return null;
+ }
+ }
+
+ /** Loads bitmap from supplied filename.
+ * Note that on Android 10+ (with scoped storage), this uses Storage Access Framework, which
+ * means Open Camera must have SAF permission to the folder DCIM/testOpenCamera.
+ */
+ private static Bitmap getBitmapFromFileCore(MainActivity activity, String filename, int inSampleSize) throws FileNotFoundException {
+ Log.d(TAG, "getBitmapFromFileCore: " + filename);
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inMutable = true;
+ //options.inSampleSize = inSampleSize;
+ if( inSampleSize > 1 ) {
+ // use inDensity for better quality, as inSampleSize uses nearest neighbour
+ // see same code in ImageSaver.setBitmapOptionsSampleSize()
+ options.inDensity = inSampleSize;
+ options.inTargetDensity = 1;
+ }
+
+ Uri uri = null;
+ Bitmap bitmap;
+
+ if( MainActivity.useScopedStorage() ) {
+ uri = getDocumentUri(filename);
+ Log.d(TAG, "uri: " + uri);
+ InputStream is = activity.getContentResolver().openInputStream(uri);
+ bitmap = BitmapFactory.decodeStream(is, null, options);
+ try {
+ is.close();
+ }
+ catch(IOException e) {
+ e.printStackTrace();
+ }
+ }
+ else {
+ bitmap = BitmapFactory.decodeFile(filename, options);
+ }
+ if( bitmap == null )
+ throw new FileNotFoundException();
+ Log.d(TAG, " done: " + bitmap);
+
+ // now need to take exif orientation into account, as some devices or camera apps store the orientation in the exif tag,
+ // which getBitmap() doesn't account for
+ ParcelFileDescriptor parcelFileDescriptor = null;
+ FileDescriptor fileDescriptor;
+ try {
+ ExifInterface exif = null;
+ if( uri != null ) {
+ parcelFileDescriptor = activity.getContentResolver().openFileDescriptor(uri, "r");
+ if( parcelFileDescriptor != null ) {
+ fileDescriptor = parcelFileDescriptor.getFileDescriptor();
+ exif = new ExifInterface(fileDescriptor);
+ }
+ }
+ else {
+ exif = new ExifInterface(filename);
+ }
+ if( exif != null ) {
+ int exif_orientation_s = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);
+ boolean needs_tf = false;
+ int exif_orientation = 0;
+ // from http://jpegclub.org/exif_orientation.html
+ // and http://stackoverflow.com/questions/20478765/how-to-get-the-correct-orientation-of-the-image-selected-from-the-default-image
+ if( exif_orientation_s == ExifInterface.ORIENTATION_UNDEFINED || exif_orientation_s == ExifInterface.ORIENTATION_NORMAL ) {
+ // leave unchanged
+ }
+ else if( exif_orientation_s == ExifInterface.ORIENTATION_ROTATE_180 ) {
+ needs_tf = true;
+ exif_orientation = 180;
+ }
+ else if( exif_orientation_s == ExifInterface.ORIENTATION_ROTATE_90 ) {
+ needs_tf = true;
+ exif_orientation = 90;
+ }
+ else if( exif_orientation_s == ExifInterface.ORIENTATION_ROTATE_270 ) {
+ needs_tf = true;
+ exif_orientation = 270;
+ }
+ else {
+ // just leave unchanged for now
+ Log.e(TAG, " unsupported exif orientation: " + exif_orientation_s);
+ }
+ Log.d(TAG, " exif orientation: " + exif_orientation);
+
+ if( needs_tf ) {
+ Log.d(TAG, " need to rotate bitmap due to exif orientation tag");
+ Matrix m = new Matrix();
+ m.setRotate(exif_orientation, bitmap.getWidth() * 0.5f, bitmap.getHeight() * 0.5f);
+ Bitmap rotated_bitmap = Bitmap.createBitmap(bitmap, 0, 0,bitmap.getWidth(), bitmap.getHeight(), m, true);
+ if( rotated_bitmap != bitmap ) {
+ bitmap.recycle();
+ bitmap = rotated_bitmap;
+ }
+ }
+ }
+ }
+ catch(IOException e) {
+ e.printStackTrace();
+ }
+ finally {
+ if( parcelFileDescriptor != null ) {
+ try {
+ parcelFileDescriptor.close();
+ }
+ catch(IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ /*{
+ for(int y=0;y= Build.VERSION_CODES.Q ?
+ MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY) :
+ MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
+
+ // first try to delete pre-existing image
+ Uri old_uri = getUriFromName(activity, folder, name);
+ if( old_uri != null ) {
+ Log.d(TAG, "delete: " + old_uri);
+ activity.getContentResolver().delete(old_uri, null, null);
+ }
+
+ contentValues = new ContentValues();
+ contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, name);
+ String extension = name.substring(name.lastIndexOf("."));
+ String mime_type = activity.getStorageUtils().getImageMimeType(extension);
+ Log.d(TAG, "mime_type: " + mime_type);
+ contentValues.put(MediaStore.Images.Media.MIME_TYPE, mime_type);
+ if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ) {
+ String relative_path = Environment.DIRECTORY_DCIM + File.separator;
+ Log.d(TAG, "relative_path: " + relative_path);
+ contentValues.put(MediaStore.Images.Media.RELATIVE_PATH, relative_path);
+ contentValues.put(MediaStore.Images.Media.IS_PENDING, 1);
+ }
+
+ uri = activity.getContentResolver().insert(folder, contentValues);
+ Log.d(TAG, "saveUri: " + uri);
+ if( uri == null ) {
+ throw new IOException();
+ }
+ outputStream = activity.getContentResolver().openOutputStream(uri);
+ }
+ else {
+ file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) + File.separator + name);
+ outputStream = new FileOutputStream(file);
+ }
+
+ bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
+ outputStream.close();
+
+ if( MainActivity.useScopedStorage() ) {
+ if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ) {
+ contentValues.clear();
+ contentValues.put(MediaStore.Images.Media.IS_PENDING, 0);
+ activity.getContentResolver().update(uri, contentValues, null, null);
+ }
+ }
+ else {
+ activity.getStorageUtils().broadcastFile(file, true, false, true, false, null);
+ }
+ }
+
+ public static class HistogramDetails {
+ public final int min_value;
+ public final int median_value;
+ public final int max_value;
+
+ HistogramDetails(int min_value, int median_value, int max_value) {
+ this.min_value = min_value;
+ this.median_value = median_value;
+ this.max_value = max_value;
+ }
+ }
+
+ /** Checks for the resultant histogram.
+ * We check that we have a single range of non-zero values.
+ * @param bitmap The bitmap to compute and check a histogram for.
+ */
+ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
+ public static HistogramDetails checkHistogram(MainActivity activity, Bitmap bitmap) {
+ int [] histogram = activity.getApplicationInterface().getHDRProcessor().computeHistogram(bitmap, true);
+ assertEquals(256, histogram.length);
+ int total = 0;
+ for(int i=0;i= middle && median_value == -1 )
+ median_value = i;
+ }
+ }
+ Log.d(TAG, "min_value: " + min_value);
+ Log.d(TAG, "median_value: " + median_value);
+ Log.d(TAG, "max_value: " + max_value);
+ return new HistogramDetails(min_value, median_value, max_value);
+ }
+
+ public static HistogramDetails subTestHDR(MainActivity activity, List inputs, String output_name, boolean test_dro, int iso, long exposure_time) {
+ return subTestHDR(activity, inputs, output_name, test_dro, iso, exposure_time, HDRProcessor.TonemappingAlgorithm.TONEMAPALGORITHM_REINHARD);
+ }
+
+ /** The testHDRX tests test the HDR algorithm on a given set of input images.
+ * By testing on a fixed sample, this makes it easier to finetune the HDR algorithm for quality and performance.
+ * To use these tests, the testdata/ subfolder should be manually copied to the test device in the DCIM/testOpenCamera/
+ * folder (so you have DCIM/testOpenCamera/testdata/). We don't use assets/ as we'd end up with huge APK sizes which takes
+ * time to transfer to the device everytime we run the tests.
+ * @param iso The ISO of the middle image (for testing Open Camera's "smart" contrast enhancement). If set to -1, then use "always" contrast enhancement.
+ * @param exposure_time The exposure time of the middle image (for testing Open Camera's "smart" contrast enhancement)
+ */
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ public static HistogramDetails subTestHDR(MainActivity activity, List inputs, String output_name, boolean test_dro, int iso, long exposure_time, HDRProcessor.TonemappingAlgorithm tonemapping_algorithm/*, HDRTestCallback test_callback*/) {
+ Log.d(TAG, "subTestHDR");
+
+ if( Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ) {
+ Log.d(TAG, "renderscript requires Android Lollipop or better");
+ return null;
+ }
+
+ try {
+ Thread.sleep(1000); // wait for camera to open
+ }
+ catch(InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ Bitmap dro_bitmap_in = null;
+ if( test_dro ) {
+ // save copy of input bitmap to also test DRO (since the HDR routine will free the inputs)
+ int mid = (inputs.size()-1)/2;
+ dro_bitmap_in = inputs.get(mid);
+ dro_bitmap_in = dro_bitmap_in.copy(dro_bitmap_in.getConfig(), true);
+ }
+
+ HistogramDetails hdrHistogramDetails = null;
+ if( inputs.size() > 1 ) {
+ String preference_hdr_contrast_enhancement = (iso==-1) ? "preference_hdr_contrast_enhancement_always" : "preference_hdr_contrast_enhancement_smart";
+ float hdr_alpha = ImageSaver.getHDRAlpha(preference_hdr_contrast_enhancement, exposure_time, inputs.size());
+ long time_s = System.currentTimeMillis();
+ try {
+ activity.getApplicationInterface().getHDRProcessor().processHDR(inputs, true, null, true, null, hdr_alpha, 4, true, tonemapping_algorithm, HDRProcessor.DROTonemappingAlgorithm.DROALGORITHM_GAINGAMMA);
+ //test_callback.doHDR(inputs, tonemapping_algorithm, hdr_alpha);
+ }
+ catch(HDRProcessorException e) {
+ e.printStackTrace();
+ throw new RuntimeException();
+ }
+ Log.d(TAG, "HDR time: " + (System.currentTimeMillis() - time_s));
+
+ saveBitmap(activity, inputs.get(0), output_name);
+ hdrHistogramDetails = checkHistogram(activity, inputs.get(0));
+ }
+ inputs.get(0).recycle();
+ inputs.clear();
+
+ if( test_dro ) {
+ inputs.add(dro_bitmap_in);
+ long time_s = System.currentTimeMillis();
+ try {
+ activity.getApplicationInterface().getHDRProcessor().processHDR(inputs, true, null, true, null, 0.5f, 4, true, HDRProcessor.TonemappingAlgorithm.TONEMAPALGORITHM_REINHARD, HDRProcessor.DROTonemappingAlgorithm.DROALGORITHM_GAINGAMMA);
+ //test_callback.doHDR(inputs, HDRProcessor.TonemappingAlgorithm.TONEMAPALGORITHM_REINHARD, 0.5f);
+ }
+ catch(HDRProcessorException e) {
+ e.printStackTrace();
+ throw new RuntimeException();
+ }
+ Log.d(TAG, "DRO time: " + (System.currentTimeMillis() - time_s));
+
+ saveBitmap(activity, inputs.get(0), "dro" + output_name);
+ checkHistogram(activity, inputs.get(0));
+ inputs.get(0).recycle();
+ inputs.clear();
+ }
+ try {
+ Thread.sleep(500);
+ }
+ catch(InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ return hdrHistogramDetails;
+ }
+
+ public static void checkHDROffsets(MainActivity activity, int [] exp_offsets_x, int [] exp_offsets_y) {
+ checkHDROffsets(activity, exp_offsets_x, exp_offsets_y, 1);
+ }
+
+ /** Checks that the HDR offsets used for auto-alignment are as expected.
+ */
+ public static void checkHDROffsets(MainActivity activity, int [] exp_offsets_x, int [] exp_offsets_y, int scale) {
+ int [] offsets_x = activity.getApplicationInterface().getHDRProcessor().offsets_x;
+ int [] offsets_y = activity.getApplicationInterface().getHDRProcessor().offsets_y;
+ for(int i=0;i inputs, String output_name, int iso, long exposure_time, float zoom_factor, TestAvgCallback cb) {
+ Log.d(TAG, "subTestAvg");
+
+ if( Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ) {
+ Log.d(TAG, "renderscript requires Android Lollipop or better");
+ return null;
+ }
+
+ try {
+ Thread.sleep(1000); // wait for camera to open
+ }
+ catch(InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ /*Bitmap nr_bitmap = getBitmapFromFile(activity, inputs.get(0));
+ long time_s = System.currentTimeMillis();
+ try {
+ for(int i=1;i times = new ArrayList<>();
+ long time_s = System.currentTimeMillis();
+ HDRProcessor.AvgData avg_data = activity.getApplicationInterface().getHDRProcessor().processAvg(bitmap0, bitmap1, avg_factor, iso, exposure_time, zoom_factor);
+ Allocation allocation = avg_data.allocation_out;
+ times.add(System.currentTimeMillis() - time_s);
+ // processAvg recycles both bitmaps
+ if( cb != null ) {
+ cb.doneProcessAvg(1);
+ }
+
+ for(int i=2;i inputs, String output_name, String gyro_debug_info_filename, float panorama_pics_per_screen, float camera_angle_x, float camera_angle_y, float gyro_tol_degrees) {
+ Log.d(TAG, "subTestPanorama");
+
+ // we set panorama_pics_per_screen in the test rather than using MyApplicationInterface.panorama_pics_per_screen,
+ // in case the latter value is changed
+
+ boolean first = true;
+ Matrix scale_matrix = null;
+ int bitmap_width = 0;
+ int bitmap_height = 0;
+ List bitmaps = new ArrayList<>();
+ for(String input : inputs) {
+ Bitmap bitmap = getBitmapFromFile(activity, input);
+
+ if( first ) {
+ bitmap_width = bitmap.getWidth();
+ bitmap_height = bitmap.getHeight();
+ Log.d(TAG, "bitmap_width: " + bitmap_width);
+ Log.d(TAG, "bitmap_height: " + bitmap_height);
+
+ final int max_height = 2080;
+ //final int max_height = 2079; // test non power of 2
+ if( bitmap_height > max_height ) {
+ float scale = ((float)max_height) / ((float)bitmap_height);
+ Log.d(TAG, "scale: " + scale);
+ scale_matrix = new Matrix();
+ scale_matrix.postScale(scale, scale);
+ }
+
+ first = false;
+ }
+
+ // downscale
+ if( scale_matrix != null ) {
+ Bitmap new_bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap_width, bitmap_height, scale_matrix, true);
+ bitmap.recycle();
+ bitmap = new_bitmap;
+ }
+
+ bitmaps.add(bitmap);
+ }
+
+ bitmap_width = bitmaps.get(0).getWidth();
+ bitmap_height = bitmaps.get(0).getHeight();
+ Log.d(TAG, "bitmap_width is now: " + bitmap_width);
+ Log.d(TAG, "bitmap_height is now: " + bitmap_height);
+
+
+ /*ImageSaver.GyroDebugInfo gyro_debug_info = null;
+ if( gyro_debug_info_filename != null ) {
+ InputStream inputStream;
+ try {
+ inputStream = new FileInputStream(gyro_debug_info_filename);
+ }
+ catch(FileNotFoundException e) {
+ Log.e(TAG, "failed to load gyro debug info file: " + gyro_debug_info_filename);
+ e.printStackTrace();
+ throw new RuntimeException();
+ }
+
+ gyro_debug_info = new ImageSaver.GyroDebugInfo();
+ if( !ImageSaver.readGyroDebugXml(inputStream, gyro_debug_info) ) {
+ Log.e(TAG, "failed to read gyro debug xml");
+ throw new RuntimeException();
+ }
+ else if( gyro_debug_info.image_info.size() != bitmaps.size() ) {
+ Log.e(TAG, "gyro debug xml has unexpected number of images: " + gyro_debug_info.image_info.size());
+ throw new RuntimeException();
+ }
+ }*/
+ //bitmaps.subList(2,bitmaps.size()).clear(); // test
+
+ Bitmap panorama = null;
+ try {
+ final boolean crop = true;
+ //final boolean crop = false; // test
+ panorama = activity.getApplicationInterface().getPanoramaProcessor().panorama(bitmaps, panorama_pics_per_screen, camera_angle_y, crop);
+ }
+ catch(PanoramaProcessorException e) {
+ e.printStackTrace();
+ fail();
+ }
+
+ saveBitmap(activity, panorama, output_name);
+ try {
+ Thread.sleep(500);
+ }
+ catch(InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ // check we've cropped correctly:
+ final float black_factor = 0.9f;
+ // top:
+ int n_black = 0;
+ for(int i=0;i> 16) & 0xff) == 0 && ((color >> 8) & 0xff) == 0 && ((color) & 0xff) == 0 ) {
+ n_black++;
+ }
+ }
+ if( n_black >= panorama.getWidth()*black_factor ) {
+ Log.e(TAG, "too many black pixels on top border: " + n_black);
+ fail();
+ }
+ // bottom:
+ n_black = 0;
+ for(int i=0;i> 16) & 0xff) == 0 && ((color >> 8) & 0xff) == 0 && ((color) & 0xff) == 0 ) {
+ n_black++;
+ }
+ }
+ if( n_black >= panorama.getWidth()*black_factor ) {
+ Log.e(TAG, "too many black pixels on bottom border: " + n_black);
+ fail();
+ }
+ // left:
+ n_black = 0;
+ for(int i=0;i> 16) & 0xff) == 0 && ((color >> 8) & 0xff) == 0 && ((color) & 0xff) == 0 ) {
+ n_black++;
+ }
+ }
+ if( n_black >= panorama.getHeight()*black_factor ) {
+ Log.e(TAG, "too many black pixels on left border: " + n_black);
+ fail();
+ }
+ // right:
+ n_black = 0;
+ for(int i=0;i> 16) & 0xff) == 0 && ((color >> 8) & 0xff) == 0 && ((color) & 0xff) == 0 ) {
+ n_black++;
+ }
+ }
+ if( n_black >= panorama.getHeight()*black_factor ) {
+ Log.e(TAG, "too many black pixels on right border: " + n_black);
+ fail();
+ }
+ }
+
+ public static void waitForTakePhotoChecks(MainActivity activity, long time_s) {
+ Preview preview = activity.getPreview();
+ View switchCameraButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_camera);
+ View switchMultiCameraButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_multi_camera);
+ View switchVideoButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_video);
+ //View flashButton = activity.findViewById(net.sourceforge.opencamera.R.id.flash);
+ //View focusButton = activity.findViewById(net.sourceforge.opencamera.R.id.focus_mode);
+ View exposureButton = activity.findViewById(net.sourceforge.opencamera.R.id.exposure);
+ View exposureLockButton = activity.findViewById(net.sourceforge.opencamera.R.id.exposure_lock);
+ View audioControlButton = activity.findViewById(net.sourceforge.opencamera.R.id.audio_control);
+ View popupButton = activity.findViewById(net.sourceforge.opencamera.R.id.popup);
+ View trashButton = activity.findViewById(net.sourceforge.opencamera.R.id.trash);
+ View shareButton = activity.findViewById(net.sourceforge.opencamera.R.id.share);
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
+ boolean is_focus_bracketing = activity.supportsFocusBracketing() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_focus_bracketing");
+ boolean is_panorama = activity.supportsPanorama() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_panorama");
+
+ // make sure the test fails rather than hanging, if for some reason we get stuck (note that testTakePhotoManualISOExposure takes over 10s on Nexus 6)
+ // also see note at end of setToDefault for Nokia 8, need to sleep briefly to avoid hanging here
+ if( !is_focus_bracketing ) {
+ assertTrue(System.currentTimeMillis() - time_s < (is_panorama ? 50000 : 20000)); // need longer for panorama on Nexus 7 for testTakePhotoPanoramaMax
+ }
+ assertTrue(!preview.isTakingPhoto() || switchCameraButton.getVisibility() == View.GONE);
+ assertTrue(!preview.isTakingPhoto() || switchMultiCameraButton.getVisibility() == View.GONE);
+ assertTrue(!preview.isTakingPhoto() || switchVideoButton.getVisibility() == View.GONE);
+ //assertTrue(!preview.isTakingPhoto() || flashButton.getVisibility() == View.GONE);
+ //assertTrue(!preview.isTakingPhoto() || focusButton.getVisibility() == View.GONE);
+ assertTrue(!preview.isTakingPhoto() || exposureButton.getVisibility() == View.GONE);
+ assertTrue(!preview.isTakingPhoto() || exposureLockButton.getVisibility() == View.GONE);
+ assertTrue(!preview.isTakingPhoto() || audioControlButton.getVisibility() == View.GONE);
+ assertTrue(!preview.isTakingPhoto() || popupButton.getVisibility() == View.GONE);
+ assertTrue(!preview.isTakingPhoto() || trashButton.getVisibility() == View.GONE);
+ assertTrue(!preview.isTakingPhoto() || shareButton.getVisibility() == View.GONE);
+ }
+
+ private static void checkFocusInitial(MainActivity activity, final String focus_value, final String focus_value_ui) {
+ String new_focus_value_ui = activity.getPreview().getCurrentFocusValue();
+ //noinspection StringEquality
+ assertTrue(new_focus_value_ui == focus_value_ui || new_focus_value_ui.equals(focus_value_ui)); // also need to do == check, as strings may be null if focus not supported
+ assertEquals(activity.getPreview().getCameraController().getFocusValue(), focus_value);
+ }
+
+ public static void checkFocusAfterTakePhoto(MainActivity activity, final String focus_value, final String focus_value_ui) {
+ // focus should be back to normal now:
+ String new_focus_value_ui = activity.getPreview().getCurrentFocusValue();
+ Log.d(TAG, "focus_value_ui: " + focus_value_ui);
+ Log.d(TAG, "new new_focus_value_ui: " + new_focus_value_ui);
+ //noinspection StringEquality
+ assertTrue(new_focus_value_ui == focus_value_ui || new_focus_value_ui.equals(focus_value_ui)); // also need to do == check, as strings may be null if focus not supported
+ String new_focus_value = activity.getPreview().getCameraController().getFocusValue();
+ Log.d(TAG, "focus_value: " + focus_value);
+ Log.d(TAG, "new focus_value: " + new_focus_value);
+ if( new_focus_value_ui != null && new_focus_value_ui.equals("focus_mode_continuous_picture") && focus_value.equals("focus_mode_auto") && new_focus_value.equals("focus_mode_continuous_picture") ) {
+ // this is fine, it just means we were temporarily in touch-to-focus mode
+ }
+ else {
+ assertEquals(new_focus_value, focus_value);
+ }
+ }
+
+ public static void checkFocusAfterTakePhoto2(MainActivity activity, final boolean touch_to_focus, final boolean single_tap_photo, final boolean double_tap_photo, final boolean test_wait_capture_result, final boolean locked_focus, final boolean can_auto_focus, final boolean can_focus_area, final int saved_count) {
+ Preview preview = activity.getPreview();
+ // in locked focus mode, taking photo should never redo an auto-focus
+ // if photo mode, we may do a refocus if the previous auto-focus failed, but not if it succeeded
+ Log.d(TAG, "2 count_cameraAutoFocus: " + preview.count_cameraAutoFocus);
+ if( locked_focus ) {
+ assertEquals(preview.count_cameraAutoFocus, (can_auto_focus ? saved_count + 1 : saved_count));
+ }
+ if( test_wait_capture_result ) {
+ // if test_wait_capture_result, then we'll have waited too long, so focus settings may have changed
+ }
+ else if( touch_to_focus ) {
+ Log.d(TAG, "can_focus_area?: " + can_focus_area);
+ Log.d(TAG, "hasFocusArea?: " + preview.hasFocusArea());
+ if( single_tap_photo || double_tap_photo ) {
+ assertFalse(preview.hasFocusArea());
+ assertNull(preview.getCameraController().getFocusAreas());
+ assertNull(preview.getCameraController().getMeteringAreas());
+ }
+ else if( can_focus_area ) {
+ assertTrue(preview.hasFocusArea());
+ assertNotNull(preview.getCameraController().getFocusAreas());
+ assertEquals(1, preview.getCameraController().getFocusAreas().size());
+ assertNotNull(preview.getCameraController().getMeteringAreas());
+ assertEquals(1, preview.getCameraController().getMeteringAreas().size());
+ }
+ else {
+ assertFalse(preview.hasFocusArea());
+ assertNull(preview.getCameraController().getFocusAreas());
+
+ if( preview.getCameraController().supportsMetering() ) {
+ // we still set metering areas
+ assertNotNull(preview.getCameraController().getMeteringAreas());
+ assertEquals(1, preview.getCameraController().getMeteringAreas().size());
+ }
+ else {
+ assertNull(preview.getCameraController().getMeteringAreas());
+ }
+ }
+ }
+ else {
+ assertFalse(preview.hasFocusArea());
+ assertNull(preview.getCameraController().getFocusAreas());
+ assertNull(preview.getCameraController().getMeteringAreas());
+ }
+ }
+
+ private static int getExpNNewFiles(MainActivity activity, final boolean is_raw) {
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
+ boolean hdr_save_expo = sharedPreferences.getBoolean(PreferenceKeys.HDRSaveExpoPreferenceKey, false);
+ boolean is_hdr = activity.supportsHDR() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_hdr");
+ boolean is_expo = activity.supportsExpoBracketing() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_expo_bracketing");
+ boolean is_focus_bracketing = activity.supportsFocusBracketing() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_focus_bracketing");
+ boolean is_fast_burst = activity.supportsFastBurst() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_fast_burst");
+ String n_expo_images_s = sharedPreferences.getString(PreferenceKeys.ExpoBracketingNImagesPreferenceKey, "3");
+ int n_expo_images = Integer.parseInt(n_expo_images_s);
+ String n_focus_bracketing_images_s = sharedPreferences.getString(PreferenceKeys.FocusBracketingNImagesPreferenceKey, "3");
+ int n_focus_bracketing_images = Integer.parseInt(n_focus_bracketing_images_s);
+ String n_fast_burst_images_s = sharedPreferences.getString(PreferenceKeys.FastBurstNImagesPreferenceKey, "5");
+ int n_fast_burst_images = Integer.parseInt(n_fast_burst_images_s);
+
+ int exp_n_new_files;
+ if( is_hdr && hdr_save_expo ) {
+ exp_n_new_files = 4;
+ if( is_raw && !activity.getApplicationInterface().isRawOnly() ) {
+ exp_n_new_files += 3;
+ }
+ }
+ else if( is_expo ) {
+ exp_n_new_files = n_expo_images;
+ if( is_raw && !activity.getApplicationInterface().isRawOnly() ) {
+ exp_n_new_files *= 2;
+ }
+ }
+ else if( is_focus_bracketing ) {
+ exp_n_new_files = n_focus_bracketing_images;
+ if( is_raw && !activity.getApplicationInterface().isRawOnly() ) {
+ exp_n_new_files *= 2;
+ }
+ }
+ else if( is_fast_burst )
+ exp_n_new_files = n_fast_burst_images;
+ else {
+ exp_n_new_files = 1;
+ if( is_raw && !activity.getApplicationInterface().isRawOnly() ) {
+ exp_n_new_files *= 2;
+ }
+ }
+ Log.d(TAG, "exp_n_new_files: " + exp_n_new_files);
+ return exp_n_new_files;
+ }
+
+ private static void checkFilenames(MainActivity activity, final boolean is_raw, final String [] files, final String [] files2) {
+ Log.d(TAG, "checkFilenames");
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
+ boolean hdr_save_expo = sharedPreferences.getBoolean(PreferenceKeys.HDRSaveExpoPreferenceKey, false);
+ boolean is_hdr = activity.supportsHDR() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_hdr");
+ boolean is_fast_burst = activity.supportsFastBurst() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_fast_burst");
+ boolean is_expo = activity.supportsExpoBracketing() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_expo_bracketing");
+ boolean is_focus_bracketing = activity.supportsFocusBracketing() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_focus_bracketing");
+
+ // check files have names as expected
+ String filename_jpeg = null;
+ String filename_dng = null;
+ int n_files = files == null ? 0 : files.length;
+ for(String file : files2) {
+ Log.d(TAG, "check file: " + file);
+ boolean is_new = true;
+ for(int j=0;j mediaFilesinSaveFolder(MainActivity activity, Uri baseUri, String bucket_id, UriType uri_type) {
+ List files = new ArrayList<>();
+ final int column_name_c = 0; // filename (without path), including extension
+
+ String [] projection;
+ switch( uri_type ) {
+ case MEDIASTORE_IMAGES:
+ projection = new String[] {MediaStore.Images.ImageColumns.DISPLAY_NAME};
+ break;
+ case MEDIASTORE_VIDEOS:
+ projection = new String[] {MediaStore.Video.VideoColumns.DISPLAY_NAME};
+ break;
+ case STORAGE_ACCESS_FRAMEWORK:
+ projection = new String[] {DocumentsContract.Document.COLUMN_DISPLAY_NAME};
+ break;
+ default:
+ throw new RuntimeException("unknown uri_type: " + uri_type);
+ }
+
+ String selection = "";
+ switch( uri_type ) {
+ case MEDIASTORE_IMAGES:
+ selection = MediaStore.Images.ImageColumns.BUCKET_ID + " = " + bucket_id;
+ break;
+ case MEDIASTORE_VIDEOS:
+ selection = MediaStore.Video.VideoColumns.BUCKET_ID + " = " + bucket_id;
+ break;
+ case STORAGE_ACCESS_FRAMEWORK:
+ break;
+ default:
+ throw new RuntimeException("unknown uri_type: " + uri_type);
+ }
+ Log.d(TAG, "selection: " + selection);
+
+ Cursor cursor = activity.getContentResolver().query(baseUri, projection, selection, null, null);
+ if( cursor != null && cursor.moveToFirst() ) {
+ Log.d(TAG, "found: " + cursor.getCount());
+
+ do {
+ String name = cursor.getString(column_name_c);
+ files.add(name);
+ }
+ while( cursor.moveToNext() );
+ }
+
+ if( cursor != null ) {
+ cursor.close();
+ }
+
+ return files;
+ }
+
+ /** Returns an array of filenames (not including full path) in the current save folder.
+ */
+ public static String [] filesInSaveFolder(MainActivity activity) {
+ Log.d(TAG, "filesInSaveFolder");
+ if( MainActivity.useScopedStorage() ) {
+ List files = new ArrayList<>();
+ if( activity.getStorageUtils().isUsingSAF() ) {
+ // See documentation for StorageUtils.getLatestMediaSAF() - for some reason with scoped storage when not having READ_EXTERNAL_STORAGE,
+ // we can't query the mediastore for files saved via SAF!
+ Uri treeUri = activity.getStorageUtils().getTreeUriSAF();
+ Uri baseUri = DocumentsContract.buildChildDocumentsUriUsingTree(treeUri, DocumentsContract.getTreeDocumentId(treeUri));
+ files.addAll( mediaFilesinSaveFolder(activity, baseUri, null, UriType.STORAGE_ACCESS_FRAMEWORK) );
+ }
+ else {
+ String save_folder = activity.getStorageUtils().getImageFolderPath();
+ String bucket_id = String.valueOf(save_folder.toLowerCase().hashCode());
+ files.addAll( mediaFilesinSaveFolder(activity, MediaStore.Images.Media.EXTERNAL_CONTENT_URI, bucket_id, UriType.MEDIASTORE_IMAGES) );
+ files.addAll( mediaFilesinSaveFolder(activity, MediaStore.Video.Media.EXTERNAL_CONTENT_URI, bucket_id, UriType.MEDIASTORE_VIDEOS) );
+ }
+
+ if( files.size() == 0 ) {
+ return null;
+ }
+ else {
+ return files.toArray(new String[0]);
+ }
+ }
+ else {
+ File folder = activity.getImageFolder();
+ File [] files = folder.listFiles();
+ if( files == null )
+ return null;
+ String [] filenames = new String[files.length];
+ for(int i=0;i 1 ? View.VISIBLE : View.GONE));
+ assertEquals(switchMultiCameraButton.getVisibility(), (activity.showSwitchMultiCamIcon() ? View.VISIBLE : View.GONE));
+ assertEquals(switchVideoButton.getVisibility(), View.VISIBLE);
+ if( !immersive_mode ) {
+ assertEquals(exposureButton.getVisibility(), exposureVisibility);
+ assertEquals(exposureLockButton.getVisibility(), exposureLockVisibility);
+ }
+ assertEquals(audioControlButton.getVisibility(), (has_audio_control_button ? View.VISIBLE : View.GONE));
+ assertEquals(popupButton.getVisibility(), View.VISIBLE);
+ assertEquals(trashButton.getVisibility(), View.GONE);
+ assertEquals(shareButton.getVisibility(), View.GONE);
+ }
+ }
+
+ public static class SubTestTakePhotoInfo {
+ public boolean has_thumbnail_anim;
+ public boolean is_hdr;
+ public boolean is_nr;
+ public boolean is_expo;
+ public int exposureVisibility;
+ public int exposureLockVisibility;
+ public String focus_value;
+ public String focus_value_ui;
+ public boolean can_auto_focus;
+ public boolean manual_can_auto_focus;
+ public boolean can_focus_area;
+ }
+
+ public static SubTestTakePhotoInfo getSubTestTakePhotoInfo(MainActivity activity, boolean immersive_mode, boolean single_tap_photo, boolean double_tap_photo) {
+ assertTrue(activity.getPreview().isPreviewStarted());
+ assertFalse(activity.getApplicationInterface().getImageSaver().test_queue_blocked);
+
+ SubTestTakePhotoInfo info = new SubTestTakePhotoInfo();
+
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
+
+ info.has_thumbnail_anim = sharedPreferences.getBoolean(PreferenceKeys.ThumbnailAnimationPreferenceKey, true);
+ info.is_hdr = activity.supportsHDR() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_hdr");
+ info.is_nr = activity.supportsNoiseReduction() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_noise_reduction");
+ info.is_expo = activity.supportsExpoBracketing() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_expo_bracketing");
+
+ boolean has_audio_control_button = !sharedPreferences.getString(PreferenceKeys.AudioControlPreferenceKey, "none").equals("none");
+
+ View switchCameraButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_camera);
+ View switchMultiCameraButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_multi_camera);
+ View switchVideoButton = activity.findViewById(net.sourceforge.opencamera.R.id.switch_video);
+ //View flashButton = activity.findViewById(net.sourceforge.opencamera.R.id.flash);
+ //View focusButton = activity.findViewById(net.sourceforge.opencamera.R.id.focus_mode);
+ View exposureButton = activity.findViewById(net.sourceforge.opencamera.R.id.exposure);
+ View exposureLockButton = activity.findViewById(net.sourceforge.opencamera.R.id.exposure_lock);
+ View audioControlButton = activity.findViewById(net.sourceforge.opencamera.R.id.audio_control);
+ View popupButton = activity.findViewById(net.sourceforge.opencamera.R.id.popup);
+ View trashButton = activity.findViewById(net.sourceforge.opencamera.R.id.trash);
+ View shareButton = activity.findViewById(net.sourceforge.opencamera.R.id.share);
+ assertEquals(switchCameraButton.getVisibility(), (immersive_mode ? View.GONE : (activity.getPreview().getCameraControllerManager().getNumberOfCameras() > 1 ? View.VISIBLE : View.GONE)));
+ assertEquals(switchMultiCameraButton.getVisibility(), (immersive_mode ? View.GONE : (activity.showSwitchMultiCamIcon() ? View.VISIBLE : View.GONE)));
+ assertEquals(switchVideoButton.getVisibility(), (immersive_mode ? View.GONE : View.VISIBLE));
+ info.exposureVisibility = exposureButton.getVisibility();
+ info.exposureLockVisibility = exposureLockButton.getVisibility();
+ assertEquals(audioControlButton.getVisibility(), ((has_audio_control_button && !immersive_mode) ? View.VISIBLE : View.GONE));
+ assertEquals(popupButton.getVisibility(), (immersive_mode ? View.GONE : View.VISIBLE));
+ assertEquals(trashButton.getVisibility(), View.GONE);
+ assertEquals(shareButton.getVisibility(), View.GONE);
+
+ info.focus_value = activity.getPreview().getCameraController().getFocusValue();
+ info.focus_value_ui = activity.getPreview().getCurrentFocusValue();
+ info.can_auto_focus = false;
+ info.manual_can_auto_focus = false;
+ info.can_focus_area = false;
+ if( info.focus_value.equals("focus_mode_auto") || info.focus_value.equals("focus_mode_macro") ) {
+ info.can_auto_focus = true;
+ }
+
+ if( info.focus_value.equals("focus_mode_auto") || info.focus_value.equals("focus_mode_macro") ) {
+ info.manual_can_auto_focus = true;
+ }
+ else if( info.focus_value.equals("focus_mode_continuous_picture") && !single_tap_photo && !double_tap_photo ) {
+ // if single_tap_photo or double_tap_photo, and continuous mode, we go straight to taking a photo rather than doing a touch to focus
+ info.manual_can_auto_focus = true;
+ }
+
+ if( activity.getPreview().getMaxNumFocusAreas() != 0 && ( info.focus_value.equals("focus_mode_auto") || info.focus_value.equals("focus_mode_macro") || info.focus_value.equals("focus_mode_continuous_picture") || info.focus_value.equals("focus_mode_continuous_video") || info.focus_value.equals("focus_mode_manual2") ) ) {
+ info.can_focus_area = true;
+ }
+ Log.d(TAG, "focus_value? " + info.focus_value);
+ Log.d(TAG, "can_auto_focus? " + info.can_auto_focus);
+ Log.d(TAG, "manual_can_auto_focus? " + info.manual_can_auto_focus);
+ Log.d(TAG, "can_focus_area? " + info.can_focus_area);
+
+ checkFocusInitial(activity, info.focus_value, info.focus_value_ui);
+
+ return info;
+ }
+
+ public static void touchToFocusChecks(MainActivity activity, final boolean single_tap_photo, final boolean double_tap_photo, final boolean manual_can_auto_focus, final boolean can_focus_area, final String focus_value, final String focus_value_ui, int saved_count) {
+ Preview preview = activity.getPreview();
+ Log.d(TAG, "1 count_cameraAutoFocus: " + preview.count_cameraAutoFocus);
+ assertEquals((manual_can_auto_focus ? saved_count + 1 : saved_count), preview.count_cameraAutoFocus);
+ Log.d(TAG, "has focus area?: " + preview.hasFocusArea());
+ if( single_tap_photo || double_tap_photo ) {
+ assertFalse(preview.hasFocusArea());
+ assertNull(preview.getCameraController().getFocusAreas());
+ assertNull(preview.getCameraController().getMeteringAreas());
+ }
+ else if( can_focus_area ) {
+ assertTrue(preview.hasFocusArea());
+ assertNotNull(preview.getCameraController().getFocusAreas());
+ assertEquals(1, preview.getCameraController().getFocusAreas().size());
+ assertNotNull(preview.getCameraController().getMeteringAreas());
+ assertEquals(1, preview.getCameraController().getMeteringAreas().size());
+ }
+ else {
+ assertFalse(preview.hasFocusArea());
+ assertNull(preview.getCameraController().getFocusAreas());
+ if( preview.getCameraController().supportsMetering() ) {
+ // we still set metering areas
+ assertNotNull(preview.getCameraController().getMeteringAreas());
+ assertEquals(1, preview.getCameraController().getMeteringAreas().size());
+ }
+ else {
+ assertNull(preview.getCameraController().getMeteringAreas());
+ }
+ }
+ String new_focus_value_ui = preview.getCurrentFocusValue();
+ //noinspection StringEquality
+ assertTrue(new_focus_value_ui == focus_value_ui || new_focus_value_ui.equals(focus_value_ui)); // also need to do == check, as strings may be null if focus not supported
+ if( focus_value.equals("focus_mode_continuous_picture") && !single_tap_photo && !double_tap_photo && preview.supportsFocus() && preview.getSupportedFocusValues().contains("focus_mode_auto") )
+ assertEquals("focus_mode_auto", preview.getCameraController().getFocusValue()); // continuous focus mode switches to auto focus on touch (unless single_tap_photo, or auto focus not supported)
+ else
+ assertEquals(preview.getCameraController().getFocusValue(), focus_value);
+ }
+
+ /** Tests the Exif tags in the resultant file. If the file is null, the uri will be
+ * used instead to read the Exif tags.
+ */
+ public static void testExif(MainActivity activity, String file, Uri uri, boolean expect_device_tags, boolean expect_datetime, boolean expect_gps) throws IOException {
+ //final String TAG_GPS_IMG_DIRECTION = "GPSImgDirection";
+ //final String TAG_GPS_IMG_DIRECTION_REF = "GPSImgDirectionRef";
+ InputStream inputStream = null;
+ ExifInterface exif;
+ if( file != null ) {
+ assertNull(uri); // should only supply one of file or uri
+ exif = new ExifInterface(file);
+ }
+ else {
+ assertNotNull(uri);
+ inputStream = activity.getContentResolver().openInputStream(uri);
+ exif = new ExifInterface(inputStream);
+ }
+
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_ORIENTATION));
+ if( !( isEmulator() && Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1 ) ) {
+ // older Android emulator versions don't store exif info in photos
+ if( expect_device_tags ) {
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_MAKE));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_MODEL));
+ }
+ else {
+ assertNull(exif.getAttribute(ExifInterface.TAG_MAKE));
+ assertNull(exif.getAttribute(ExifInterface.TAG_MODEL));
+
+ assertNull(exif.getAttribute(ExifInterface.TAG_F_NUMBER));
+ assertNull(exif.getAttribute(ExifInterface.TAG_EXPOSURE_TIME));
+ assertNull(exif.getAttribute(ExifInterface.TAG_FLASH));
+ assertNull(exif.getAttribute(ExifInterface.TAG_FOCAL_LENGTH));
+ assertNull(exif.getAttribute(ExifInterface.TAG_IMAGE_DESCRIPTION));
+ assertNull(exif.getAttribute(ExifInterface.TAG_IMAGE_UNIQUE_ID));
+ assertNull(exif.getAttribute(ExifInterface.TAG_USER_COMMENT));
+ assertNull(exif.getAttribute(ExifInterface.TAG_ARTIST));
+ assertNull(exif.getAttribute(ExifInterface.TAG_COPYRIGHT));
+ }
+
+ if( expect_datetime ) {
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_DATETIME));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_DATETIME_ORIGINAL));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_DATETIME_DIGITIZED));
+ if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ) {
+ // not available on Galaxy Nexus Android 4.3 at least
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_SUBSEC_TIME));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_SUBSEC_TIME_ORIGINAL));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_SUBSEC_TIME_DIGITIZED));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_OFFSET_TIME));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_OFFSET_TIME_ORIGINAL));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_OFFSET_TIME_DIGITIZED));
+ }
+ }
+ else {
+ assertNull(exif.getAttribute(ExifInterface.TAG_DATETIME));
+ assertNull(exif.getAttribute(ExifInterface.TAG_DATETIME_ORIGINAL));
+ assertNull(exif.getAttribute(ExifInterface.TAG_DATETIME_DIGITIZED));
+ assertNull(exif.getAttribute(ExifInterface.TAG_SUBSEC_TIME));
+ assertNull(exif.getAttribute(ExifInterface.TAG_SUBSEC_TIME_ORIGINAL));
+ assertNull(exif.getAttribute(ExifInterface.TAG_SUBSEC_TIME_DIGITIZED));
+ assertNull(exif.getAttribute(ExifInterface.TAG_OFFSET_TIME));
+ assertNull(exif.getAttribute(ExifInterface.TAG_OFFSET_TIME_ORIGINAL));
+ assertNull(exif.getAttribute(ExifInterface.TAG_OFFSET_TIME_DIGITIZED));
+ }
+
+ if( expect_gps ) {
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF));
+ // can't read custom tags, even though we can write them?!
+ //assertTrue(exif.getAttribute(TAG_GPS_IMG_DIRECTION) != null);
+ //assertTrue(exif.getAttribute(TAG_GPS_IMG_DIRECTION_REF) != null);
+ }
+ else {
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF));
+ // can't read custom tags, even though we can write them?!
+ //assertTrue(exif.getAttribute(TAG_GPS_IMG_DIRECTION) == null);
+ //assertTrue(exif.getAttribute(TAG_GPS_IMG_DIRECTION_REF) == null);
+ }
+ }
+
+ if( inputStream != null ) {
+ inputStream.close();
+ }
+ }
+}
diff --git a/app/src/androidTest/java/net/sourceforge/opencamera/test/AvgTests.java b/app/src/androidTest/java/net/sourceforge/opencamera/test/AvgTests.java
index 6e5334ce5364f4b3c7716084adf5af1155cd97c8..fbc1119b654c69fb2b37d24842a64ed1b20992d7 100644
--- a/app/src/androidTest/java/net/sourceforge/opencamera/test/AvgTests.java
+++ b/app/src/androidTest/java/net/sourceforge/opencamera/test/AvgTests.java
@@ -10,6 +10,7 @@ public class AvgTests {
* folder (so you have DCIM/testOpenCamera/testdata/). We don't use assets/ as we'd end up with huge APK sizes which takes
* time to transfer to the device every time we run the tests.
* On Android 10+, scoped storage permission needs to be given to Open Camera for the DCIM/testOpenCamera/ folder.
+ * UPDATE: now deprecated, replaced with AvgTestSuite.
*/
public static Test suite() {
TestSuite suite = new TestSuite(MainTests.class.getName());
diff --git a/app/src/androidTest/java/net/sourceforge/opencamera/test/HDRNTests.java b/app/src/androidTest/java/net/sourceforge/opencamera/test/HDRNTests.java
index 4c82cfd8a2d3dfcd2e48639e456c5b5a66161130..fe14fab5c946c1ca13173861b895a82e34dc35eb 100644
--- a/app/src/androidTest/java/net/sourceforge/opencamera/test/HDRNTests.java
+++ b/app/src/androidTest/java/net/sourceforge/opencamera/test/HDRNTests.java
@@ -10,6 +10,7 @@ public class HDRNTests {
* folder (so you have DCIM/testOpenCamera/testdata/). We don't use assets/ as we'd end up with huge APK sizes which takes
* time to transfer to the device every time we run the tests.
* On Android 10+, scoped storage permission needs to be given to Open Camera for the DCIM/testOpenCamera/ folder.
+ * UPDATE: now deprecated, replaced with HDRNTestSuite.
*/
public static Test suite() {
TestSuite suite = new TestSuite(MainTests.class.getName());
diff --git a/app/src/androidTest/java/net/sourceforge/opencamera/test/HDRTests.java b/app/src/androidTest/java/net/sourceforge/opencamera/test/HDRTests.java
index 5c6b5622412ada30e95696045ee975052da70aa8..029065386b83e58e8acf90fcf277301dbfead88b 100644
--- a/app/src/androidTest/java/net/sourceforge/opencamera/test/HDRTests.java
+++ b/app/src/androidTest/java/net/sourceforge/opencamera/test/HDRTests.java
@@ -10,6 +10,7 @@ public class HDRTests {
* folder (so you have DCIM/testOpenCamera/testdata/). We don't use assets/ as we'd end up with huge APK sizes which takes
* time to transfer to the device every time we run the tests.
* On Android 10+, scoped storage permission needs to be given to Open Camera for the DCIM/testOpenCamera/ folder.
+ * UPDATE: now deprecated, replaced with HDRTestSuite.
*/
public static Test suite() {
TestSuite suite = new TestSuite(MainTests.class.getName());
diff --git a/app/src/androidTest/java/net/sourceforge/opencamera/test/MainActivityTest.java b/app/src/androidTest/java/net/sourceforge/opencamera/test/MainActivityTest.java
index d59715747073e88d9abd282f733e48f42a1ad344..b1db2c87b7d97d40191bb5b4b700d3a3ae6b5d68 100644
--- a/app/src/androidTest/java/net/sourceforge/opencamera/test/MainActivityTest.java
+++ b/app/src/androidTest/java/net/sourceforge/opencamera/test/MainActivityTest.java
@@ -7,10 +7,8 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.IOException;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
@@ -18,7 +16,7 @@ import java.util.Set;
import net.sourceforge.opencamera.LocationSupplier;
import net.sourceforge.opencamera.MyPreferenceFragment;
-import net.sourceforge.opencamera.PanoramaProcessorException;
+import net.sourceforge.opencamera.TestUtils;
import net.sourceforge.opencamera.cameracontroller.CameraController2;
import net.sourceforge.opencamera.HDRProcessor;
import net.sourceforge.opencamera.HDRProcessorException;
@@ -31,22 +29,18 @@ import net.sourceforge.opencamera.preview.VideoProfile;
import net.sourceforge.opencamera.SaveLocationHistory;
import net.sourceforge.opencamera.cameracontroller.CameraController;
import net.sourceforge.opencamera.preview.Preview;
+import net.sourceforge.opencamera.ui.DrawPreview;
import net.sourceforge.opencamera.ui.FolderChooserDialog;
import net.sourceforge.opencamera.ui.MainUI;
import net.sourceforge.opencamera.ui.PopupView;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
-import android.content.ContentUris;
-import android.content.ContentValues;
import android.content.Intent;
import android.content.SharedPreferences;
//import android.content.res.AssetManager;
-import android.database.Cursor;
import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
import android.graphics.Color;
-import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.PointF;
import android.hardware.camera2.CameraMetadata;
@@ -54,17 +48,11 @@ import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.params.TonemapCurve;
import android.location.Location;
import android.media.CamcorderProfile;
-import androidx.exifinterface.media.ExifInterface;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Build;
-import android.os.Environment;
-import android.os.ParcelFileDescriptor;
import android.preference.PreferenceManager;
-import android.provider.DocumentsContract;
import android.provider.MediaStore;
-import android.renderscript.Allocation;
-import androidx.annotation.RequiresApi;
import android.test.ActivityInstrumentationTestCase2;
import android.test.TouchUtils;
import android.util.Log;
@@ -90,13 +78,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2TestUtils.initTest(), it's useful
+ // to leave the application in a default state after running tests)
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mActivity);
SharedPreferences.Editor editor = settings.edit();
editor.clear();
@@ -251,6 +221,15 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 1 ) {
@@ -1925,11 +1916,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 1 ) {
@@ -2084,10 +2067,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 mediaFilesinSaveFolder(Uri baseUri, String bucket_id, UriType uri_type) {
- List files = new ArrayList<>();
- final int column_name_c = 0; // filename (without path), including extension
-
- String [] projection;
- switch( uri_type ) {
- case MEDIASTORE_IMAGES:
- projection = new String[] {MediaStore.Images.ImageColumns.DISPLAY_NAME};
- break;
- case MEDIASTORE_VIDEOS:
- projection = new String[] {MediaStore.Video.VideoColumns.DISPLAY_NAME};
- break;
- case STORAGE_ACCESS_FRAMEWORK:
- projection = new String[] {DocumentsContract.Document.COLUMN_DISPLAY_NAME};
- break;
- default:
- throw new RuntimeException("unknown uri_type: " + uri_type);
- }
-
- String selection = "";
- switch( uri_type ) {
- case MEDIASTORE_IMAGES:
- selection = MediaStore.Images.ImageColumns.BUCKET_ID + " = " + bucket_id;
- break;
- case MEDIASTORE_VIDEOS:
- selection = MediaStore.Video.VideoColumns.BUCKET_ID + " = " + bucket_id;
- break;
- case STORAGE_ACCESS_FRAMEWORK:
- break;
- default:
- throw new RuntimeException("unknown uri_type: " + uri_type);
- }
- Log.d(TAG, "selection: " + selection);
-
- Cursor cursor = mActivity.getContentResolver().query(baseUri, projection, selection, null, null);
- if( cursor != null && cursor.moveToFirst() ) {
- Log.d(TAG, "found: " + cursor.getCount());
-
- do {
- String name = cursor.getString(column_name_c);
- files.add(name);
- }
- while( cursor.moveToNext() );
- }
-
- if( cursor != null ) {
- cursor.close();
- }
-
- return files;
- }
-
/** Returns an array of filenames (not including full path) in the current save folder.
*/
private String [] filesInSaveFolder() {
- Log.d(TAG, "filesInSaveFolder");
- if( MainActivity.useScopedStorage() ) {
- List files = new ArrayList<>();
- if( mActivity.getStorageUtils().isUsingSAF() ) {
- // See documentation for StorageUtils.getLatestMediaSAF() - for some reason with scoped storage when not having READ_EXTERNAL_STORAGE,
- // we can't query the mediastore for files saved via SAF!
- Uri treeUri = mActivity.getStorageUtils().getTreeUriSAF();
- Uri baseUri = DocumentsContract.buildChildDocumentsUriUsingTree(treeUri, DocumentsContract.getTreeDocumentId(treeUri));
- files.addAll( mediaFilesinSaveFolder(baseUri, null, UriType.STORAGE_ACCESS_FRAMEWORK) );
- }
- else {
- String save_folder = mActivity.getStorageUtils().getImageFolderPath();
- String bucket_id = String.valueOf(save_folder.toLowerCase().hashCode());
- files.addAll( mediaFilesinSaveFolder(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, bucket_id, UriType.MEDIASTORE_IMAGES) );
- files.addAll( mediaFilesinSaveFolder(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, bucket_id, UriType.MEDIASTORE_VIDEOS) );
- }
-
- if( files.size() == 0 ) {
- return null;
- }
- else {
- return files.toArray(new String[0]);
- }
- }
- else {
- File folder = mActivity.getImageFolder();
- File [] files = folder.listFiles();
- if( files == null )
- return null;
- String [] filenames = new String[files.length];
- for(int i=0;i 1 ? View.VISIBLE : View.GONE));
- assertEquals(switchMultiCameraButton.getVisibility(), (mActivity.showSwitchMultiCamIcon() ? View.VISIBLE : View.GONE));
- assertEquals(switchVideoButton.getVisibility(), View.VISIBLE);
- if( !immersive_mode ) {
- assertEquals(exposureButton.getVisibility(), exposureVisibility);
- assertEquals(exposureLockButton.getVisibility(), exposureLockVisibility);
- }
- assertEquals(audioControlButton.getVisibility(), (has_audio_control_button ? View.VISIBLE : View.GONE));
- assertEquals(popupButton.getVisibility(), View.VISIBLE);
- assertEquals(trashButton.getVisibility(), View.GONE);
- assertEquals(shareButton.getVisibility(), View.GONE);
- }
+ return TestUtils.filesInSaveFolder(mActivity);
}
/*
* Note that we pass test_wait_capture_result as a parameter rather than reading from the activity, as for some reason this sometimes resets to false?! Declaring it volatile doesn't fix the problem.
*/
private void subTestTakePhoto(boolean locked_focus, boolean immersive_mode, boolean touch_to_focus, boolean wait_after_focus, boolean single_tap_photo, boolean double_tap_photo, boolean is_raw, boolean test_wait_capture_result) throws InterruptedException {
- assertTrue(mPreview.isPreviewStarted());
- assertFalse(mActivity.getApplicationInterface().getImageSaver().test_queue_blocked);
-
- SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mActivity);
- boolean has_thumbnail_anim = sharedPreferences.getBoolean(PreferenceKeys.ThumbnailAnimationPreferenceKey, true);
- boolean has_audio_control_button = !sharedPreferences.getString(PreferenceKeys.AudioControlPreferenceKey, "none").equals("none");
- boolean is_dro = mActivity.supportsDRO() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_dro");
- boolean is_hdr = mActivity.supportsHDR() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_hdr");
- boolean is_nr = mActivity.supportsNoiseReduction() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_noise_reduction");
- boolean is_expo = mActivity.supportsExpoBracketing() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_expo_bracketing");
- boolean is_focus_bracketing = mActivity.supportsFocusBracketing() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_focus_bracketing");
- boolean is_fast_burst = mActivity.supportsFastBurst() && sharedPreferences.getString(PreferenceKeys.PhotoModePreferenceKey, "preference_photo_mode_std").equals("preference_photo_mode_fast_burst");
- String n_expo_images_s = sharedPreferences.getString(PreferenceKeys.ExpoBracketingNImagesPreferenceKey, "3");
- int n_expo_images = Integer.parseInt(n_expo_images_s);
- String n_focus_bracketing_images_s = sharedPreferences.getString(PreferenceKeys.FocusBracketingNImagesPreferenceKey, "3");
- int n_focus_bracketing_images = Integer.parseInt(n_focus_bracketing_images_s);
- String n_fast_burst_images_s = sharedPreferences.getString(PreferenceKeys.FastBurstNImagesPreferenceKey, "5");
- int n_fast_burst_images = Integer.parseInt(n_fast_burst_images_s);
+ Thread.sleep(500); // needed for Pixel 6 Pro with Camera 2 API
+
+ TestUtils.SubTestTakePhotoInfo info = TestUtils.getSubTestTakePhotoInfo(mActivity, immersive_mode, single_tap_photo, double_tap_photo);
+ boolean has_thumbnail_anim = info.has_thumbnail_anim;
+ boolean is_hdr = info.is_hdr;
+ boolean is_nr = info.is_nr;
+ boolean is_expo = info.is_expo;
+ int exposureVisibility = info.exposureVisibility;
+ int exposureLockVisibility = info.exposureLockVisibility;
+ String focus_value = info.focus_value;
+ String focus_value_ui = info.focus_value_ui;
+ boolean can_auto_focus = info.can_auto_focus;
+ boolean manual_can_auto_focus = info.manual_can_auto_focus;
+ boolean can_focus_area = info.can_focus_area;
int saved_count_cameraTakePicture = mPreview.count_cameraTakePicture;
@@ -3822,54 +3334,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 1 ? View.VISIBLE : View.GONE)));
- assertEquals(switchMultiCameraButton.getVisibility(), (immersive_mode ? View.GONE : (mActivity.showSwitchMultiCamIcon() ? View.VISIBLE : View.GONE)));
- assertEquals(switchVideoButton.getVisibility(), (immersive_mode ? View.GONE : View.VISIBLE));
- int exposureVisibility = exposureButton.getVisibility();
- int exposureLockVisibility = exposureLockButton.getVisibility();
- assertEquals(audioControlButton.getVisibility(), ((has_audio_control_button && !immersive_mode) ? View.VISIBLE : View.GONE));
- assertEquals(popupButton.getVisibility(), (immersive_mode ? View.GONE : View.VISIBLE));
- assertEquals(trashButton.getVisibility(), View.GONE);
- assertEquals(shareButton.getVisibility(), View.GONE);
-
- String focus_value = mPreview.getCameraController().getFocusValue();
- String focus_value_ui = mPreview.getCurrentFocusValue();
- boolean can_auto_focus = false;
- boolean manual_can_auto_focus = false;
- boolean can_focus_area = false;
- if( focus_value.equals("focus_mode_auto") || focus_value.equals("focus_mode_macro") ) {
- can_auto_focus = true;
- }
-
- if( focus_value.equals("focus_mode_auto") || focus_value.equals("focus_mode_macro") ) {
- manual_can_auto_focus = true;
- }
- else if( focus_value.equals("focus_mode_continuous_picture") && !single_tap_photo && !double_tap_photo ) {
- // if single_tap_photo or double_tap_photo, and continuous mode, we go straight to taking a photo rather than doing a touch to focus
- manual_can_auto_focus = true;
- }
-
- if( mPreview.getMaxNumFocusAreas() != 0 && ( focus_value.equals("focus_mode_auto") || focus_value.equals("focus_mode_macro") || focus_value.equals("focus_mode_continuous_picture") || focus_value.equals("focus_mode_continuous_video") || focus_value.equals("focus_mode_manual2") ) ) {
- can_focus_area = true;
- }
- Log.d(TAG, "focus_value? " + focus_value);
- Log.d(TAG, "can_auto_focus? " + can_auto_focus);
- Log.d(TAG, "manual_can_auto_focus? " + manual_can_auto_focus);
- Log.d(TAG, "can_focus_area? " + can_focus_area);
int saved_count = mPreview.count_cameraAutoFocus;
- checkFocusInitial(focus_value, focus_value_ui);
+ //checkFocusInitial(focus_value, focus_value_ui);
int saved_thumbnail_count = mActivity.getApplicationInterface().getDrawPreview().test_thumbnail_anim_count;
Log.d(TAG, "saved_thumbnail_count: " + saved_thumbnail_count);
@@ -3889,43 +3356,6 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 0);
+ assertTrue(popup_height > 0);
+ assertEquals(popup_width, test_popup_width);
+ assertEquals(popup_height, test_popup_height);
+
+ // now reopen popup view, and check the same dimensions
+ closePopupMenu();
+
+ openPopupMenu();
+
+ int new_popup_width = popup_view.getWidth();
+ int new_popup_height = popup_view.getHeight();
+ test_popup_width = mActivity.getMainUI().test_saved_popup_width;
+ test_popup_height = mActivity.getMainUI().test_saved_popup_height;
+ Log.d(TAG, "new_popup_width: " + new_popup_width);
+ Log.d(TAG, "new_popup_height: " + new_popup_height);
+ Log.d(TAG, "test_popup_width: " + test_popup_width);
+ Log.d(TAG, "test_popup_height: " + test_popup_height);
+ assertEquals(popup_width, new_popup_width);
+ assertEquals(popup_height, new_popup_height);
+ assertEquals(popup_width, test_popup_width);
+ assertEquals(popup_height, test_popup_height);
+ }
+
+ /* Tests with ui_right vs ui_top layout.
+ */
+ public void testRightLayout() {
+ Log.d(TAG, "testRightLayout");
+
+ setToDefault();
+ {
+ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mActivity);
+ SharedPreferences.Editor editor = settings.edit();
+ editor.putString(PreferenceKeys.UIPlacementPreferenceKey, "ui_right");
+ editor.apply();
+ updateForSettings();
+ }
+
+ openPopupMenu();
+
+ Point display_size = new Point();
+ {
+ Display display = mActivity.getWindowManager().getDefaultDisplay();
+ display.getSize(display_size);
+ Log.d(TAG, "display_size: " + display_size.x + " x " + display_size.y);
+ }
+ View settingsButton = mActivity.findViewById(net.sourceforge.opencamera.R.id.settings);
+ View galleryButton = mActivity.findViewById(net.sourceforge.opencamera.R.id.gallery);
+
+ Log.d(TAG, "settings right: " + settingsButton.getRight());
+ Log.d(TAG, "settings top: " + settingsButton.getTop());
+ Log.d(TAG, "gallery right: " + galleryButton.getRight());
+ Log.d(TAG, "gallery top: " + galleryButton.getTop());
+
+ final float scale = mActivity.getResources().getDisplayMetrics().density;
+ int expected_gap = (int) (MainUI.privacy_indicator_gap_dp * scale + 0.5f); // convert dps to pixels;
+ if( mActivity.getSystemOrientation() == MainActivity.SystemOrientation.PORTRAIT ) {
+ assertTrue(settingsButton.getBottom() > (int)(0.8*display_size.y));
+ assertEquals(display_size.x, settingsButton.getRight());
+ // position may be 1 coordinate different on some devices, e.g., Galaxy Nexus
+ // have 14 pixel gap on Pixel 6 Pro
+ assertEquals((double)(display_size.y-1-expected_gap), (double)(galleryButton.getBottom()), 14.0+1.0e-5);
+ assertEquals(display_size.x-expected_gap, galleryButton.getRight());
+ }
+ else {
+ assertTrue(settingsButton.getRight() > (int)(0.8*display_size.x));
+ assertEquals(0, settingsButton.getTop());
+ assertEquals(display_size.x-expected_gap, galleryButton.getRight());
+ assertEquals(expected_gap, galleryButton.getTop());
+ }
+
+ {
+ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mActivity);
+ SharedPreferences.Editor editor = settings.edit();
+ editor.putString(PreferenceKeys.UIPlacementPreferenceKey, "ui_top");
+ editor.apply();
+ updateForSettings();
+ }
+
+ Log.d(TAG, "settings right: " + settingsButton.getRight());
+ Log.d(TAG, "settings top: " + settingsButton.getTop());
+ Log.d(TAG, "gallery right: " + galleryButton.getRight());
+ Log.d(TAG, "gallery top: " + galleryButton.getTop());
- pauseAndResume();
- assertFalse(mActivity.popupIsOpen());
- clickView(popupButton);
- while( !mActivity.popupIsOpen() ) {
+ if( mActivity.getSystemOrientation() == MainActivity.SystemOrientation.PORTRAIT ) {
+ assertTrue(settingsButton.getBottom() < (int)(0.2*display_size.y));
+ assertEquals(display_size.x, settingsButton.getRight());
+ // position may be 1 coordinate different on some devices, e.g., Galaxy Nexus
+ // have 14 pixel gap on Pixel 6 Pro
+ assertEquals((double)(display_size.y-1-expected_gap), (double)(galleryButton.getBottom()), 14.0+1.0e-5);
+ assertEquals(display_size.x-expected_gap, galleryButton.getRight());
+ }
+ else {
+ assertTrue(settingsButton.getRight() < (int)(0.2*display_size.x));
+ assertEquals(0, settingsButton.getTop());
+ assertEquals(display_size.x-expected_gap, galleryButton.getRight());
+ assertEquals(expected_gap, galleryButton.getTop());
}
+
+ openPopupMenu();
}
/* Tests layout bug with popup menu.
@@ -8280,10 +7834,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 1 ) {
@@ -9130,7 +8628,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 1 ) {
- // use inDensity for better quality, as inSampleSize uses nearest neighbour
- // see same code in ImageSaver.setBitmapOptionsSampleSize()
- options.inDensity = inSampleSize;
- options.inTargetDensity = 1;
- }
-
- Uri uri = null;
- Bitmap bitmap;
-
- if( MainActivity.useScopedStorage() ) {
- uri = getDocumentUri(filename);
- Log.d(TAG, "uri: " + uri);
- InputStream is = mActivity.getContentResolver().openInputStream(uri);
- bitmap = BitmapFactory.decodeStream(is, null, options);
- try {
- is.close();
- }
- catch(IOException e) {
- e.printStackTrace();
- }
- }
- else {
- bitmap = BitmapFactory.decodeFile(filename, options);
- }
- if( bitmap == null )
- throw new FileNotFoundException();
- Log.d(TAG, " done: " + bitmap);
-
- // now need to take exif orientation into account, as some devices or camera apps store the orientation in the exif tag,
- // which getBitmap() doesn't account for
- ParcelFileDescriptor parcelFileDescriptor = null;
- FileDescriptor fileDescriptor;
- try {
- ExifInterface exif = null;
- if( uri != null ) {
- parcelFileDescriptor = mActivity.getContentResolver().openFileDescriptor(uri, "r");
- if( parcelFileDescriptor != null ) {
- fileDescriptor = parcelFileDescriptor.getFileDescriptor();
- exif = new ExifInterface(fileDescriptor);
- }
- }
- else {
- exif = new ExifInterface(filename);
- }
- if( exif != null ) {
- int exif_orientation_s = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);
- boolean needs_tf = false;
- int exif_orientation = 0;
- // from http://jpegclub.org/exif_orientation.html
- // and http://stackoverflow.com/questions/20478765/how-to-get-the-correct-orientation-of-the-image-selected-from-the-default-image
- if( exif_orientation_s == ExifInterface.ORIENTATION_UNDEFINED || exif_orientation_s == ExifInterface.ORIENTATION_NORMAL ) {
- // leave unchanged
- }
- else if( exif_orientation_s == ExifInterface.ORIENTATION_ROTATE_180 ) {
- needs_tf = true;
- exif_orientation = 180;
- }
- else if( exif_orientation_s == ExifInterface.ORIENTATION_ROTATE_90 ) {
- needs_tf = true;
- exif_orientation = 90;
- }
- else if( exif_orientation_s == ExifInterface.ORIENTATION_ROTATE_270 ) {
- needs_tf = true;
- exif_orientation = 270;
- }
- else {
- // just leave unchanged for now
- Log.e(TAG, " unsupported exif orientation: " + exif_orientation_s);
- }
- Log.d(TAG, " exif orientation: " + exif_orientation);
-
- if( needs_tf ) {
- Log.d(TAG, " need to rotate bitmap due to exif orientation tag");
- Matrix m = new Matrix();
- m.setRotate(exif_orientation, bitmap.getWidth() * 0.5f, bitmap.getHeight() * 0.5f);
- Bitmap rotated_bitmap = Bitmap.createBitmap(bitmap, 0, 0,bitmap.getWidth(), bitmap.getHeight(), m, true);
- if( rotated_bitmap != bitmap ) {
- bitmap.recycle();
- bitmap = rotated_bitmap;
- }
- }
- }
- }
- catch(IOException e) {
- e.printStackTrace();
- }
- finally {
- if( parcelFileDescriptor != null ) {
- try {
- parcelFileDescriptor.close();
- }
- catch(IOException e) {
- e.printStackTrace();
- }
- }
- }
- /*{
- for(int y=0;y= middle && median_value == -1 )
- median_value = i;
- }
- }
- Log.d(TAG, "min_value: " + min_value);
- Log.d(TAG, "median_value: " + median_value);
- Log.d(TAG, "max_value: " + max_value);
- return new HistogramDetails(min_value, median_value, max_value);
+ private TestUtils.HistogramDetails checkHistogram(Bitmap bitmap) {
+ return TestUtils.checkHistogram(mActivity, bitmap);
}
- private HistogramDetails subTestHDR(List inputs, String output_name, boolean test_dro, int iso, long exposure_time) throws IOException, InterruptedException {
- return subTestHDR(inputs, output_name, test_dro, iso, exposure_time, HDRProcessor.TonemappingAlgorithm.TONEMAPALGORITHM_REINHARD);
+ private TestUtils.HistogramDetails subTestHDR(List inputs, String output_name, boolean test_dro, int iso, long exposure_time) {
+ return TestUtils.subTestHDR(mActivity, inputs, output_name, test_dro, iso, exposure_time);
}
- /** The following testHDRX tests test the HDR algorithm on a given set of input images.
- * By testing on a fixed sample, this makes it easier to finetune the HDR algorithm for quality and performance.
- * To use these tests, the testdata/ subfolder should be manually copied to the test device in the DCIM/testOpenCamera/
- * folder (so you have DCIM/testOpenCamera/testdata/). We don't use assets/ as we'd end up with huge APK sizes which takes
- * time to transfer to the device everytime we run the tests.
- * @param iso The ISO of the middle image (for testing Open Camera's "smart" contrast enhancement). If set to -1, then use "always" contrast enhancement.
- * @param exposure_time The exposure time of the middle image (for testing Open Camera's "smart" contrast enhancement)
- */
- @TargetApi(Build.VERSION_CODES.LOLLIPOP)
- private HistogramDetails subTestHDR(List inputs, String output_name, boolean test_dro, int iso, long exposure_time, HDRProcessor.TonemappingAlgorithm tonemapping_algorithm) throws IOException, InterruptedException {
- Log.d(TAG, "subTestHDR");
-
- if( Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ) {
- Log.d(TAG, "renderscript requires Android Lollipop or better");
- return null;
- }
-
- Thread.sleep(1000); // wait for camera to open
-
- Bitmap dro_bitmap_in = null;
- if( test_dro ) {
- // save copy of input bitmap to also test DRO (since the HDR routine will free the inputs)
- int mid = (inputs.size()-1)/2;
- dro_bitmap_in = inputs.get(mid);
- dro_bitmap_in = dro_bitmap_in.copy(dro_bitmap_in.getConfig(), true);
- }
-
- HistogramDetails hdrHistogramDetails = null;
- if( inputs.size() > 1 ) {
- String preference_hdr_contrast_enhancement = (iso==-1) ? "preference_hdr_contrast_enhancement_always" : "preference_hdr_contrast_enhancement_smart";
- float hdr_alpha = ImageSaver.getHDRAlpha(preference_hdr_contrast_enhancement, exposure_time, inputs.size());
- long time_s = System.currentTimeMillis();
- try {
- mActivity.getApplicationInterface().getHDRProcessor().processHDR(inputs, true, null, true, null, hdr_alpha, 4, true, tonemapping_algorithm, HDRProcessor.DROTonemappingAlgorithm.DROALGORITHM_GAINGAMMA);
- }
- catch(HDRProcessorException e) {
- e.printStackTrace();
- throw new RuntimeException();
- }
- Log.d(TAG, "HDR time: " + (System.currentTimeMillis() - time_s));
-
- saveBitmap(inputs.get(0), output_name);
- hdrHistogramDetails = checkHistogram(inputs.get(0));
- }
- inputs.get(0).recycle();
- inputs.clear();
-
- if( test_dro ) {
- inputs.add(dro_bitmap_in);
- long time_s = System.currentTimeMillis();
- try {
- mActivity.getApplicationInterface().getHDRProcessor().processHDR(inputs, true, null, true, null, 0.5f, 4, true, HDRProcessor.TonemappingAlgorithm.TONEMAPALGORITHM_REINHARD, HDRProcessor.DROTonemappingAlgorithm.DROALGORITHM_GAINGAMMA);
- }
- catch(HDRProcessorException e) {
- e.printStackTrace();
- throw new RuntimeException();
- }
- Log.d(TAG, "DRO time: " + (System.currentTimeMillis() - time_s));
-
- saveBitmap(inputs.get(0), "dro" + output_name);
- checkHistogram(inputs.get(0));
- inputs.get(0).recycle();
- inputs.clear();
- }
- Thread.sleep(500);
-
- return hdrHistogramDetails;
+ private TestUtils.HistogramDetails subTestHDR(List inputs, String output_name, boolean test_dro, int iso, long exposure_time, HDRProcessor.TonemappingAlgorithm tonemapping_algorithm/*, HDRTestCallback test_callback*/) {
+ return TestUtils.subTestHDR(mActivity, inputs, output_name, test_dro, iso, exposure_time, tonemapping_algorithm);
}
private void checkHDROffsets(int [] exp_offsets_x, int [] exp_offsets_y) {
- checkHDROffsets(exp_offsets_x, exp_offsets_y, 1);
+ TestUtils.checkHDROffsets(mActivity, exp_offsets_x, exp_offsets_y);
}
- /** Checks that the HDR offsets used for auto-alignment are as expected.
- */
private void checkHDROffsets(int [] exp_offsets_x, int [] exp_offsets_y, int scale) {
- int [] offsets_x = mActivity.getApplicationInterface().getHDRProcessor().offsets_x;
- int [] offsets_y = mActivity.getApplicationInterface().getHDRProcessor().offsets_y;
- for(int i=0;i inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "saintpaul/input2.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "saintpaul/input3.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "saintpaul/input4.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "saintpaul/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "saintpaul/input3.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "saintpaul/input4.jpg") );
// actual ISO unknown, so guessing
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR1_output.jpg", false, 1600, 1000000000L);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR1_output.jpg", false, 1600, 1000000000L);
int [] exp_offsets_x = {0, 0, 0};
int [] exp_offsets_y = {0, 0, 0};
@@ -12494,13 +11714,13 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "saintpaul/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "saintpaul/input2.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "saintpaul/input3.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "saintpaul/input4.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "saintpaul/input5.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "saintpaul/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "saintpaul/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "saintpaul/input3.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "saintpaul/input4.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "saintpaul/input5.jpg") );
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR1_exp5_output.jpg", false, -1, -1);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR1_exp5_output.jpg", false, -1, -1);
int [] exp_offsets_x = {0, 0, 0, 0, 0};
int [] exp_offsets_y = {0, 0, 0, 0, 0};
@@ -12519,9 +11739,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "stlouis/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "stlouis/input2.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "stlouis/input3.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "stlouis/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "stlouis/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "stlouis/input3.jpg") );
// actual ISO unknown, so guessing
subTestHDR(inputs, "testHDR2_output.jpg", false, 1600, (long)(1000000000L*2.5));
@@ -12540,11 +11760,11 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR3/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR3/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR3/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR3/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR3/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR3/input2.jpg") );
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR3_output.jpg", false, 40, 1000000000L/680);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR3_output.jpg", false, 40, 1000000000L/680);
int [] exp_offsets_x = {0, 0, 0};
int [] exp_offsets_y = {1, 0, -1};
@@ -12564,9 +11784,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR4/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR4/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR4/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR4/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR4/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR4/input2.jpg") );
subTestHDR(inputs, "testHDR4_output.jpg", true, 102, 1000000000L/60);
@@ -12584,9 +11804,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR5/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR5/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR5/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR5/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR5/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR5/input2.jpg") );
subTestHDR(inputs, "testHDR5_output.jpg", false, 40, 1000000000L/398);
@@ -12608,9 +11828,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR6/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR6/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR6/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR6/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR6/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR6/input2.jpg") );
subTestHDR(inputs, "testHDR6_output.jpg", false, 40, 1000000000L/2458);
@@ -12628,9 +11848,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR7/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR7/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR7/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR7/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR7/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR7/input2.jpg") );
subTestHDR(inputs, "testHDR7_output.jpg", false, 40, 1000000000L/538);
@@ -12648,9 +11868,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR8/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR8/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR8/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR8/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR8/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR8/input2.jpg") );
subTestHDR(inputs, "testHDR8_output.jpg", false, 40, 1000000000L/148);
@@ -12668,9 +11888,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR9/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR9/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR9/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR9/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR9/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR9/input2.jpg") );
subTestHDR(inputs, "testHDR9_output.jpg", false, 40, 1000000000L/1313);
@@ -12688,9 +11908,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR10/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR10/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR10/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR10/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR10/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR10/input2.jpg") );
subTestHDR(inputs, "testHDR10_output.jpg", false, 107, 1000000000L/120);
@@ -12708,11 +11928,11 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR11/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR11/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR11/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR11/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR11/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR11/input2.jpg") );
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR11_output.jpg", true, 40, 1000000000L/2662);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR11_output.jpg", true, 40, 1000000000L/2662);
int [] exp_offsets_x = {-2, 0, 1};
int [] exp_offsets_y = {1, 0, -1};
@@ -12732,9 +11952,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR12/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR12/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR12/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR12/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR12/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR12/input2.jpg") );
subTestHDR(inputs, "testHDR12_output.jpg", true, 1196, 1000000000L/12);
@@ -12752,9 +11972,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR13/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR13/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR13/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR13/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR13/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR13/input2.jpg") );
subTestHDR(inputs, "testHDR13_output.jpg", false, 323, 1000000000L/24);
@@ -12772,9 +11992,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR14/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR14/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR14/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR14/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR14/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR14/input2.jpg") );
subTestHDR(inputs, "testHDR14_output.jpg", false, 40, 1000000000L/1229);
@@ -12792,9 +12012,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR15/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR15/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR15/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR15/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR15/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR15/input2.jpg") );
subTestHDR(inputs, "testHDR15_output.jpg", false, 40, 1000000000L/767);
@@ -12812,9 +12032,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR16/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR16/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR16/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR16/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR16/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR16/input2.jpg") );
subTestHDR(inputs, "testHDR16_output.jpg", false, 52, 1000000000L/120);
@@ -12832,9 +12052,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR17/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR17/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR17/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR17/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR17/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR17/input2.jpg") );
subTestHDR(inputs, "testHDR17_output.jpg", true, 557, 1000000000L/12);
@@ -12856,11 +12076,11 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR18/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR18/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR18/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR18/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR18/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR18/input2.jpg") );
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR18_output.jpg", true, 100, 1000000000L/800);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR18_output.jpg", true, 100, 1000000000L/800);
int [] exp_offsets_x = {0, 0, 0};
int [] exp_offsets_y = {0, 0, 0};
@@ -12881,9 +12101,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR19/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR19/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR19/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR19/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR19/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR19/input2.jpg") );
subTestHDR(inputs, "testHDR19_output.jpg", true, 100, 1000000000L/160);
@@ -12901,9 +12121,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR20/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR20/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR20/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR20/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR20/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR20/input2.jpg") );
subTestHDR(inputs, "testHDR20_output.jpg", true, 100, 1000000000L*2);
@@ -12921,9 +12141,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR21/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR21/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR21/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR21/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR21/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR21/input2.jpg") );
// ISO and exposure unknown, so guessing
subTestHDR(inputs, "testHDR21_output.jpg", true, 800, 1000000000L/12);
@@ -12942,9 +12162,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR22/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR22/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR22/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR22/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR22/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR22/input2.jpg") );
subTestHDR(inputs, "testHDR22_output.jpg", true, 391, 1000000000L/12);
@@ -12966,10 +12186,10 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0068.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0064.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0068.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0064.png") );
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_exp2_output.jpg", false, -1, -1);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_exp2_output.jpg", false, -1, -1);
int [] exp_offsets_x = {0, 0};
int [] exp_offsets_y = {0, 0};
@@ -12988,10 +12208,10 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0070.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0062.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0070.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0062.png") );
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_exp2b_output.jpg", false, -1, -1);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_exp2b_output.jpg", false, -1, -1);
int [] exp_offsets_x = {0, 0};
int [] exp_offsets_y = {0, 0};
@@ -13007,12 +12227,12 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0068.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0066.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0064.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0068.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0066.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0064.png") );
// ISO unknown, so guessing
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_output.jpg", false, 1600, 1000000000L);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_output.jpg", false, 1600, 1000000000L);
int [] exp_offsets_x = {0, 0, 0};
int [] exp_offsets_y = {0, 0, 0};
@@ -13032,12 +12252,12 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0070.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0068.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0064.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0062.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0070.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0068.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0064.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0062.png") );
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_exp4_output.jpg", false, -1, -1);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_exp4_output.jpg", false, -1, -1);
int [] exp_offsets_x = {0, 0, 0, 0};
int [] exp_offsets_y = {0, 0, 0, 0};
@@ -13056,13 +12276,13 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0070.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0068.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0066.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0064.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0062.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0070.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0068.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0066.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0064.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0062.png") );
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_exp5_output.jpg", false, -1, -1);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_exp5_output.jpg", false, -1, -1);
int [] exp_offsets_x = {0, 0, 0, 0, 0};
int [] exp_offsets_y = {0, 0, 0, 0, 0};
@@ -13082,14 +12302,14 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0072.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0070.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0068.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0064.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0062.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0061.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0072.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0070.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0068.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0064.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0062.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0061.png") );
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_exp6_output.jpg", false, -1, -1);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_exp6_output.jpg", false, -1, -1);
int [] exp_offsets_x = {0, 0, 0, 0, 0, 0};
int [] exp_offsets_y = {0, 0, 0, 0, 0, 0};
@@ -13108,15 +12328,15 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0072.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0070.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0068.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0066.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0064.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0062.png") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR23/memorial0061.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0072.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0070.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0068.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0066.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0064.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0062.png") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR23/memorial0061.png") );
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_exp7_output.jpg", false, -1, -1);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR23_exp7_output.jpg", false, -1, -1);
int [] exp_offsets_x = {0, 0, 0, 0, 0, 0, 0};
int [] exp_offsets_y = {0, 0, 0, 0, 0, 0, 0};
@@ -13136,9 +12356,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR24/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR24/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR24/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR24/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR24/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR24/input2.jpg") );
subTestHDR(inputs, "testHDR24_output.jpg", true, 40, 1000000000L/422);
@@ -13156,9 +12376,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR25/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR25/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR25/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR25/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR25/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR25/input2.jpg") );
subTestHDR(inputs, "testHDR25_output.jpg", true, 40, 1000000000L/1917);
@@ -13176,11 +12396,11 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2 inputs = new ArrayList<>();
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR26/input0.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR26/input1.jpg") );
- inputs.add( getBitmapFromFile(hdr_images_path + "testHDR26/input2.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR26/input0.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR26/input1.jpg") );
+ inputs.add( getBitmapFromFile(TestUtils.hdr_images_path + "testHDR26/input2.jpg") );
- HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR26_output.jpg", true, 40, 1000000000L/5325);
+ TestUtils.HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR26_output.jpg", true, 40, 1000000000L/5325);
int [] exp_offsets_x = {-1, 0, 1};
int [] exp_offsets_y = {1, 0, -1};
@@ -13199,9 +12419,9 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2