ihaart2
Inverse 2-D Haar wavelet transform
Description
specifies
how the inverse 2-D Haar transform handles integer-valued data, using
any of the previous syntaxes.xrec
= ihaart2(___,integerflag
)
Examples
Inverse 2-D Haar Transform of an Image
Obtain the inverse 2-D Haar transform of image and view the reconstructed image.
Load the image and obtain its 2-D Haar transform.
im = imread('mandrill.png');
[a,h,v,d] = haart2(im);
Use the inverse 2-D Haar transform to reconstruct the image.
xrec = ihaart2(a,h,v,d);
Compare the original and reconstructed images.
imagesc(im)
title('Original RGB Image')
figure
imagesc(uint8(xrec))
title('Reconstructed RGB Image')
Inverse 2-D Haar Transform of Image Limited to Specified Level
Obtain the 2-D Haar transform of an image limiting the transform to 2 levels.
Load and view the image of a cameraman.
im = imread('cameraman.tif');
imagesc(im)
Obtain the 2-D Haar transform using the default maximum number of levels.
[a,h,v,d] = haart2(im);
Reconstruct the image using the inverse 2-D Haar transform and view the image. Notice the near-perfect reconstruction.
xrec = ihaart2(a,h,v,d); imagesc(xrec)
Reconstruct and view the image using the inverse 2-D Haar transform, limited to level 2. Level 2 corresponds to the fourth scale because scale is defined as , where j is the level.
xrec1 = ihaart2(a,h,v,d,2); imagesc(xrec1)
Using fewer levels returns the average of the original image at level 2.
Inverse 2-D Haar Transform of Image Limited to Integer Data
Obtain the 2-D Haar transform of an image limiting the transform to integer data.
Load the image of a cameraman.
im = imread('cameraman.tif');
Obtain the 2-D Haar transform using the 'integer'
flag.
[a,h,v,d]=haart2(im,'integer');
Reconstruct the image using the inverse 2-D Haar transform and view the image.
xrec = ihaart2(a,h,v,d,'integer');
imagesc(xrec)
Use integer data when you need to reduce the amount of memory used compared to noninteger data.
Input Arguments
a
— Approximation coefficients
scalar | matrix
Approximation coefficients, specified as a scalar or matrix
of coefficients, depending on the level to which the 2-D Haar transform
was calculated. a
is an output from the haart2
function. Approximation, or scaling,
coefficients are a lowpass representation of the input. If a
and
the elements of h
, v
, and d
,
are vectors, xrec
is a vector. If a
and
the elements of h
, v
, and d
are
matrices, xrec
is a matrix, where each column
is the inverse 2-D Haar transform of the corresponding columns in a
and h
, v
,
or d
.
Data Types: single
| double
h
— Horizontal detail coefficients
matrix | cell array
Horizontal detail coefficients by level, specified as a matrix
or cell array of matrices. h
is an output from
the haart2
function. If h
is
a matrix, the 2-D Haar transform was computed only down to one level
coarser in resolution.
Data Types: single
| double
v
— Vertical detail coefficients
matrix or | cell array
Vertical detail coefficients by level, specified as a matrix
or cell array of matrices. v
is an output from
the haart2
function. If v
is
a matrix, the 2-D Haar transform was computed only down to one level
coarser in resolution.
Data Types: single
| double
d
— Diagonal detail coefficients
matrix or | cell array
Diagonal detail coefficients by level, specified as a matrix
or cell array of matrices. d
is an output from
the haart2
function. If d
is
a matrix, the 2-D Haar transform was computed only down to one level
coarser in resolution.
Data Types: single
| double
level
— Maximum level
0
(default) | nonnegative integer
Maximum level to which to invert the Haar transform, specified
as a nonnegative integer. If h
is a cell array, level
is
less than or equal to length(h)-1
. If h
is
a vector or matrix, level
must equal 0
or
be unspecified.
integerflag
— Integer-valued data handling
'noninteger'
(default) | 'integer'
Integer-valued data handling, specified as either 'noninteger'
or
'integer'
. 'noninteger'
does not
preserve integer-valued data in the 2-D Haar transform, and
'integer'
preserves it. The
'integer'
option applies only if all elements of
inputs, a
, h
,
v
, and d
, are integer-valued.
The inverse 2-D Haar transform algorithm, however, uses floating-point
arithmetic.
Output Arguments
xrec
— Inverse 2-D Haar wavelet transform
matrix
2-D Haar wavelet transform, returned as a matrix.
Data Types: single
| double
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
Version History
Introduced in R2016b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)