This repository has been deprecated from Android 12 Beta
https://developer.android.com/about/versions/12/deprecations#renderscript
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 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
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.
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.
- Import the class
Manager
,CreateHDR
in the required activity.import com.adrino.hdr.Manager; import com.adrino.hdr.corehdr.CreateHDR;
- Create instance of
Manager
class, by passing through the Application Context to the ConstructorManager consist of methods for creation of camera activity and HDR ImageManager hdrManager = new Manager(getApplicationContext());
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 |
- Inflate the
CameraActivity
by callingperform(Activity)
methodhdrManager.perform(this);
- 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);
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 ☕☕☕