libidx
|
#include <pyramids.h>
Public Member Functions | |
gaussian_pyramid (double c=0.375) | |
virtual | ~gaussian_pyramid () |
Destructor. | |
idx< T > | reduce (idx< T > &in, uint n=1) |
rect< uint > | reduce_rect (const rect< uint > &r, uint n=1) |
returns a reduced rectangle by n reductions. | |
uint | count_reductions (uint insz, uint outsz, uint &dist) |
return number of reductions necessary for size insz to be <= outsz | |
uint | count_reductions_exact (rect< uint > &inr, rect< uint > &outr, rect< uint > &inr_exact) |
idx< T > | expand (idx< T > &in, uint n=1) |
rect< uint > | expand_rect (const rect< uint > &r, uint n=1) |
returns a expanded rectangle by n expansions. | |
uint | count_expansions (uint insz, uint outsz, uint &dist) |
return number of expansions necessary for size insz to be >= outsz | |
idx< T > | cut_pad (idx< T > &in, int nz) |
Public Attributes | |
idx< T > | red_tin |
Protected Attributes | |
double | a |
idx< T > | filter |
A gaussian pyramid implementation. Uses a 5x5 kernel as sepcified in Burt and Adelson paper with a=0.375. This is the same setup used in Matlab too. In 1D, f is given as follows:
f = [1/4-a/2 1/4 a 1/4 1/4-a/2]
The scaling in this implementation fixed to 2, so each downsampled image will be almost half the size in each dimension.
One can create a Laplacian Image Pyramid by successively reducing and expanding an image and taking the difference between two.
ebl::gaussian_pyramid< T >::gaussian_pyramid | ( | double | c = 0.375 | ) |
The default value of is 0.375, however one can enter diffferent values to change the shape of the gaussian.
uint ebl::gaussian_pyramid< T >::count_reductions_exact | ( | rect< uint > & | inr, |
rect< uint > & | outr, | ||
rect< uint > & | inr_exact | ||
) |
return number of reductions and set size of the input (closest to current one) to exactly downsample to outr (aspect ratio unchanged).
idx< T > ebl::gaussian_pyramid< T >::cut_pad | ( | idx< T > & | in, |
int | nz | ||
) |
copy in into out, cutting the extra padding of size nz on each border, and return out.
idx< T > ebl::gaussian_pyramid< T >::expand | ( | idx< T > & | in, |
uint | n = 1 |
||
) |
The expand method for obtaining an upsampled version of a given image from gaussian pyramid. Optionally specify with n how many expansions to perform. Returns the result. <in> is a -idx2- of -double-. <out> is a -idx2- of -double-. <out> can be any size, it will be resized approriately.
idx< T > ebl::gaussian_pyramid< T >::reduce | ( | idx< T > & | in, |
uint | n = 1 |
||
) |
The reduce method for obtaining a scaled down version of the given image. Optionally specify with n how many reductions to perform. Returns the result.
<in> is a -idx2- of -double-. <out> is a -idx2- of -double-. <out> can be any size, it will be resized approriately. Size of <in> might not be suitable for convolving with a 5x5 filter, followed by a 2x2 downsampling. Borders might be removed to satisfy convolution requirements. The original imaage will not be modified, a copy will be generated.