https://github.com/anthonyray/haarwavelets
A simple implementation of one dimensional and two dimensional Haar wavelets.
https://github.com/anthonyray/haarwavelets
Last synced: 11 months ago
JSON representation
A simple implementation of one dimensional and two dimensional Haar wavelets.
- Host: GitHub
- URL: https://github.com/anthonyray/haarwavelets
- Owner: anthonyray
- Created: 2014-11-18T15:57:55.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-01-07T13:13:16.000Z (over 11 years ago)
- Last Synced: 2024-04-15T09:15:23.401Z (about 2 years ago)
- Language: Java
- Size: 125 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Haar Wavelet Transformation
This is a simple implementation of one dimensional and two dimensional Haar Wavelets Transformation.
For each transformation, the input is a 1D or 2D array of double, and the output is a 1D or 2D array of double.
## Usage
### One dimensional Haar Wavelet transformation
Let's take the following example. We have a 1D array of double.
```java
double[] data = {9, 7, 3, 5 };
```
We instantiate a class to transform the matrix :
```java
HaarWavelet1D oneD = new HaarWavelet1D(data);
oneD.standardDecomposition();
```
The result is :
```
Processing One Dimensional Haar Wavelet Transformation
Input :
9.0, 7.0, 3.0, 5.0
Output :
6.0, 2.0, 1.0, -1.0
```
### Two dimensional Haar Wavelet transformation
Let's take the following example : We have a 2D array of double.
```java
double[][] data2D = {{9, 7, 3, 5 },{2, 4, 8, 4 },{1, 7, 13, 4 },{19, 27, 53, 45 }};
HaarWavelet2D twoD = new HaarWavelet2D(data2D);
```
The result is the following :
```
Processing Two Dimensional Haar Wavelet Transformation
Input :
9.0, 7.0, 3.0, 5.0
2.0, 4.0, 8.0, 4.0
1.0, 7.0, 13.0, 4.0
19.0, 27.0, 53.0, 45.0
Output :
13.1875, -3.6875, -1.75, 2.375
-7.9375, 3.9375, 1.75, -1.875
0.75, 1.75, 1.0, -1.5
-14.875, 5.375, 0.5, 0.25
```
### Applying to images
Using the ```ImageMatrixIO``` class, you can convert an RGB image to a matrix and a matrix to an RGB image. An example is written in the ```Demo``` class.