Skip to content

This repository has been deprecated. HDR Image Production using Exposure Fusion ( Android - RenderScript )

License

Notifications You must be signed in to change notification settings

AdarshRevankar/Exposure-Fusion

Repository files navigation

High Dynamic Range (HDR) - Exposure Fusion - Android 📸

contributions welcome License: MIT


Deprecation ⚠️

This repository has been deprecated from Android 12 Beta

https://developer.android.com/about/versions/12/deprecations#renderscript

logo 1


2 3 4

Exposure Fusion Algorithm

Library created for the demonstration of computation of HDR on Android Device. This library uses RenderScript extensively for the computation of pixels.

This Application is provided with beautiful interface as Camera Activity (optional), so as to provide the demonstration of the usage of the HDR Library.

Workflow of Exposure Fusion Algorithm is given below

Structure

Structure of the hdr library is given below

    com.adrino.hdr
    |
    |-> corecamera
    |	|-> CameraActivity (c)
    |
    |-> corehdr
    |	|-> CreateHDR (c)
    |
    |-> Manager (c)

NOTE: Some of the Classes, Interfaces, Abstract Classes are not shown here. But in the back end it will be utilised. (c) indicates the classes


Install

Using the following steps you can include the hdr library in your Application

Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Step 2. Add the dependency
Provide the latest_version with the Release Versions ( Get this version HDRv...)

dependencies {
    implementation 'com.github.AdarshRevankar:Exposure-Fusion:latest_version'
}

That's it! you have included the artifacts (jar, aar) into your project.


Usage

Library is provided with the class com.adrino.hdr.Manager which consist of a single gateway method, which gives access to all the functionalities. We will try to inflate CameraActivity and try to produce hdr Image.

  1. Import the class Manager, CreateHDR in the required activity.
    import com.adrino.hdr.Manager;
    import com.adrino.hdr.corehdr.CreateHDR;
  2. Create instance of Manager class, by passing through the Application Context to the Constructor
    Manager hdrManager = new Manager(getApplicationContext());
    Manager consist of methods for creation of camera activity and HDR Image
Method What it does?
List<Bitmap> perform(List<Bitmap>, CreateHDR.Actions) Returns the required Action specified over List of images sent
void perform(Activity currActivity) Intents the CameraActivity over the current activity and provides the camera interface
List<Bitmap> perform(Activity currActivity, boolean deleteImages) Returns the required Action specified over List of images sent by providing the CameraActivity. Provides boolean deleteImages if you want to retain or delete the captured images (Security Reasons)
List<Bitmap> getBmpImageList(File file) Returns the captured images from the Storage, when the External Storage location is given. For example, getExternalFilesDir(null) is passed as the file parameter
  1. Inflate the CameraActivity by calling perform(Activity) method
    hdrManager.perform(this);
  2. Performing HDR over the captured Images
    // Get the captured Images
    List<Bitmap> inputImageList = hdrManager.getBmpImageList(getExternalFilesDir(null));
    
    // Perform HDR Action over the Captured Images
    List<Bitmap> outputImageList = hdrManager.perform(inputImageList, CreateHDR.Actions.HDR);
    
    // Get the Bitmap HDR Image
    Bitmap hdrOutput = outputImageList.get(0);

Things to be noted

CreateHDR.Actions is enumeration which has following items. Which is used to specify which intermediate result is required. Accordingly the size of output list varies.

Action Description inputImageList.size() outputImageList.size()
HDR Performs HDR 3 1
CONTRAST Edge Detection N N
EXPOSED Detects Well Exposed Area N N
SATURATION Detects Vivid Colors N N
GAUSSIAN Gaussian Pyramid of Images N N ( N- Pyramids, M-Levels)
LAPLACIAN Laplacian Pyramid of Images N N ( N- Pyramids, M-Levels)
RESULTANT Resultant of Images 3 1 (1- Pyramid, M-Levels)

Here, Pyramids behave differently. So, we have to handle them carefully. GAUSSIAN will return N Pyramids each of size M ( M - Depends on the resolution of Image ). So, the outputImageList contains N x M Images.


If any error, suggestions please do contact Adarsh Revankar [email protected] Enjoy learning ☕☕☕