libeblearn
|
Creates a laplacian pyramid of the input. More...
#include <ebl_preprocessing.h>
Public Member Functions | |
laplacian_pyramid_module (uint nscales, midxdim &sizes, uint mode=MEAN_RESIZE, module_1_1< T, Tstate > *pp=NULL, bool own_pp=true, idxdim *dzpad=NULL, bool global_norm=true, bool local_norm=false, bool local_norm2=false, bool color_norm=false, bool cnorm_across=true, bool keep_aspect_ratio=true, const char *name="laplacian_pyramid") | |
laplacian_pyramid_module (uint nscales, idxdim &kerdims, midxdim &sizes, uint mode=MEAN_RESIZE, module_1_1< T, Tstate > *pp=NULL, bool own_pp=true, idxdim *dzpad=NULL, bool global_norm=true, bool local_norm=false, bool local_norm2=false, bool color_norm=false, bool cnorm_across=true, bool keep_aspect_ratio=true, const char *name="laplacian_pyramid") | |
laplacian_pyramid_module (uint nscales, midxdim &kerdims, midxdim &sizes, uint mode=MEAN_RESIZE, module_1_1< T, Tstate > *pp=NULL, bool own_pp=true, idxdim *dzpad=NULL, bool global_norm=true, bool local_norm=false, bool local_norm2=false, bool color_norm=false, bool cnorm_across=true, bool keep_aspect_ratio=true, const char *name="laplacian_pyramid") | |
laplacian_pyramid_module (uint nscales, uint mode=MEAN_RESIZE, module_1_1< T, Tstate > *pp=NULL, bool own_pp=true, idxdim *dzpad=NULL, bool global_norm=true, bool local_norm=false, bool local_norm2=false, bool color_norm=false, bool cnorm_across=true, bool keep_aspect_ratio=true, const char *name="laplacian_pyramid") | |
virtual void | init () |
Init filters and normalizations. | |
virtual void | fprop (Tstate &in, Tstate &out) |
forward propagation from in to out | |
virtual void | fprop (Tstate &in, mstate< Tstate > &out) |
virtual void | fprop (Tstate &in, midx< T > &out) |
virtual void | bprop (Tstate &in, mstate< Tstate > &out) |
backward propagation from in to out (empty) | |
virtual void | bbprop (Tstate &in, mstate< Tstate > &out) |
bbackward propagation from in to out (empty) | |
virtual mfidxdim | fprop_size (mfidxdim &isize) |
virtual mfidxdim | bprop_size (mfidxdim &osize) |
virtual std::string | describe () |
Returns a string describing this module and its parameters. | |
virtual uint | nlayers () |
Returns the number of layers produced by this resizing module. | |
virtual void | set_scalings (vector< float > &scalings) |
Protected Member Functions | |
void | resize (idx< T > &im, idxdim &tgt, rect< int > &inr, rect< int > &outr) |
Resize 'im' to target 'tgt' and update 'inr' and 'outr'. | |
void | blur (idx< T > &filter, idx< T > &in, idx< T > &out, rect< int > &roi) |
idx< T > | highpass (idx< T > &in, idx< T > &blurred, idxdim &tgt, rect< int > &inr, bool first) |
void | subsample (idx< T > &in, idx< T > &out, rect< int > &inr) |
void | normalize_globally (idx< T > &in) |
void | normalize_intensity_globally (idx< T > &in) |
Called by normalize_globally(). | |
void | normalize_color_globally (idx< T > &in) |
Called by normalize_globally(). | |
void | normalize_globally2 (idx< T > &in) |
Called by normalize_globally(). | |
Protected Attributes | |
uint | nscales |
Number of scales in the pyramid. | |
uint | iscale |
Current scale being produced during fprop. | |
vector< float > | scalings |
Scaling factor for multiple pyramids. | |
midxdim | sizes |
The target dimensions for each scale. | |
midxdim | kerdims |
The kernel dimensions for each scale. | |
idx< T > | burt |
The Burt-Adelson blurring kernel. | |
vector< idx< T > > | filters |
The filtering gaussian kernels for each scale. | |
vector< zpad_module< T, Tstate > * > | pads |
Padding class for input. | |
bool | use_pad |
Pad before filtering or not. | |
bool | global_norm |
Globally normalize outputs or not. | |
bool | local_norm |
Locally normalize outputs or not. | |
bool | local_norm2 |
Locally normalize outputs or not. | |
bool | color_lnorm |
Locally normalize color or not. | |
bool | cnorm_across |
Locally color across each other or separately. | |
bool | keep_aspect_ratio |
Keep aspect ratio or not. | |
bool | mirror |
Use mirror padding instead of zero padding. | |
idx< T > | blurred |
The blurred buffer. | |
idx< T > | blurred_high |
The blurred buffer for high frequency extraction. | |
idx< T > | high0 |
Temporary buffer for high frequencies. | |
Tstate | padded |
A temporary buffer for padding. | |
vector< layers< T, Tstate > * > | norms |
Brightness normalization modules. | |
vector< layers< T, Tstate > * > | cnorms |
Color normalization modules. | |
midx< T > | tmp |
temporary buffer | |
mstate< Tstate > | tmp2 |
temporary buffer | |
mstate< Tstate > | tmp3 |
temporary buffer | |
Tstate | inpp |
Tstate | outpp |
Temporary buffers for preprocessing. | |
midx< T > | outs |
Latest outputs. | |
mstate< Tstate > | zpad_out |
Zero-padded outputs. | |
bool | burt_filtering_only |
Only use Burt-Adelson for filtering. |
Creates a laplacian pyramid of the input.
ebl::laplacian_pyramid_module< T, Tstate >::laplacian_pyramid_module | ( | uint | nscales, |
midxdim & | sizes, | ||
uint | mode = MEAN_RESIZE , |
||
module_1_1< T, Tstate > * | pp = NULL , |
||
bool | own_pp = true , |
||
idxdim * | dzpad = NULL , |
||
bool | global_norm = true , |
||
bool | local_norm = false , |
||
bool | local_norm2 = false , |
||
bool | color_norm = false , |
||
bool | cnorm_across = true , |
||
bool | keep_aspect_ratio = true , |
||
const char * | name = "laplacian_pyramid" |
||
) |
Constructor. Preprocessing module pp will be deleted upon destruction.
nscales | Number of scales of pyramid, starting from target dimensions down with a subsampling ratio of 2. |
pp | An optional pointer to a preprocessing module. If NULL, no preprocessing is performed. This module is responsible for destroying the preprocessing module. |
pp_original | Preprocessing for original channel. |
add_original | If true, the first object in the output will be the original preprocessed patch of target size, without Laplacian. |
mode | The type of resizing (MEAN_RESIZE, BILINEAR_RESIZE, GAUSSIAN_RESIZE). |
sizes | A vector of target dimensions (heightxwidth). If it contains 1 target only, simply scale by .5 at each scale. Otherwise, manually set each target to the ones found in this vector. |
zpad | Optional zero-padding is added on each side |
global_norm | If true (default), removes global mean from output and divides it by standard deviation. |
local_norm | If true, removes local mean and divide by std dev in 5x5 neighborhood. |
color_norm | If true, contrast-normalize color channels. |
cnorm_across | If true and color_norm is true, color is normalized across each other, rather than layer by layer. |
keep_aspect_ratio | If true (default), aspect ratio is kept. |
ebl::laplacian_pyramid_module< T, Tstate >::laplacian_pyramid_module | ( | uint | nscales, |
idxdim & | kerdims, | ||
midxdim & | sizes, | ||
uint | mode = MEAN_RESIZE , |
||
module_1_1< T, Tstate > * | pp = NULL , |
||
bool | own_pp = true , |
||
idxdim * | dzpad = NULL , |
||
bool | global_norm = true , |
||
bool | local_norm = false , |
||
bool | local_norm2 = false , |
||
bool | color_norm = false , |
||
bool | cnorm_across = true , |
||
bool | keep_aspect_ratio = true , |
||
const char * | name = "laplacian_pyramid" |
||
) |
Constructor. Preprocessing module pp will be deleted upon destruction.
nscales | Number of scales of pyramid, starting from target dimensions down with a subsampling ratio of 2. |
pp | An optional pointer to a preprocessing module. If NULL, no preprocessing is performed. This module is responsible for destroying the preprocessing module. |
pp_original | Preprocessing for original channel. |
add_original | If true, the first object in the output will be the original preprocessed patch of target size, without Laplacian. |
mode | The type of resizing (MEAN_RESIZE, BILINEAR_RESIZE, GAUSSIAN_RESIZE). |
sizes | A vector of target dimensions (heightxwidth). If it contains 1 target only, simply scale by .5 at each scale. Otherwise, manually set each target to the ones found in this vector. |
zpad | Optional zero-padding is added on each side |
global_norm | If true (default), removes global mean from output and divides it by standard deviation. |
local_norm | If true, removes local mean and divide by std dev in 5x5 neighborhood. |
color_norm | If true, contrast-normalize color channels. |
cnorm_across | If true and color_norm is true, color is normalized across each other, rather than layer by layer. |
keep_aspect_ratio | If true (default), aspect ratio is kept. |
ebl::laplacian_pyramid_module< T, Tstate >::laplacian_pyramid_module | ( | uint | nscales, |
midxdim & | kerdims, | ||
midxdim & | sizes, | ||
uint | mode = MEAN_RESIZE , |
||
module_1_1< T, Tstate > * | pp = NULL , |
||
bool | own_pp = true , |
||
idxdim * | dzpad = NULL , |
||
bool | global_norm = true , |
||
bool | local_norm = false , |
||
bool | local_norm2 = false , |
||
bool | color_norm = false , |
||
bool | cnorm_across = true , |
||
bool | keep_aspect_ratio = true , |
||
const char * | name = "laplacian_pyramid" |
||
) |
Constructor. Preprocessing module pp will be deleted upon destruction.
nscales | Number of scales of pyramid, starting from target dimensions down with a subsampling ratio of 2. |
pp | An optional pointer to a preprocessing module. If NULL, no preprocessing is performed. This module is responsible for destroying the preprocessing module. |
pp_original | Preprocessing for original channel. |
add_original | If true, the first object in the output will be the original preprocessed patch of target size, without Laplacian. |
mode | The type of resizing (MEAN_RESIZE, BILINEAR_RESIZE, GAUSSIAN_RESIZE). |
sizes | A vector of target dimensions (heightxwidth). If it contains 1 target only, simply scale by .5 at each scale. Otherwise, manually set each target to the ones found in this vector. |
zpad | Optional zero-padding is added on each side |
global_norm | If true (default), removes global mean from output and divides it by standard deviation. |
local_norm | If true, removes local mean and divide by std dev in 5x5 neighborhood. |
color_norm | If true, contrast-normalize color channels. |
cnorm_across | If true and color_norm is true, color is normalized across each other, rather than layer by layer. |
keep_aspect_ratio | If true (default), aspect ratio is kept. |
ebl::laplacian_pyramid_module< T, Tstate >::laplacian_pyramid_module | ( | uint | nscales, |
uint | mode = MEAN_RESIZE , |
||
module_1_1< T, Tstate > * | pp = NULL , |
||
bool | own_pp = true , |
||
idxdim * | dzpad = NULL , |
||
bool | global_norm = true , |
||
bool | local_norm = false , |
||
bool | local_norm2 = false , |
||
bool | color_norm = false , |
||
bool | cnorm_across = true , |
||
bool | keep_aspect_ratio = true , |
||
const char * | name = "laplacian_pyramid" |
||
) |
Constructor without target dimensions. set_dimensions should be called later. Preprocessing module pp will be deleted upon destruction.
nscales | Number of scales of pyramid, starting from target dimensions down with a subsampling ratio of 2. |
pp | An optional pointer to a preprocessing module. If NULL, no preprocessing is performed. This module is responsible for destroying the preprocessing module. |
pp_original | Preprocessing for original channel. |
add_original | If true, the first object in the output will be the original preprocessed patch of target size, without Laplacian. |
mode | The type of resizing (MEAN_RESIZE, BILINEAR_RESIZE, GAUSSIAN_RESIZE). |
zpad | Optional zero-padding is added on each side |
global_norm | If true (default), removes global mean from output and divides it by standard deviation. |
local_norm | If true, removes local mean and divide by std dev in 5x5 neighborhood. |
color_norm | If true, contrast-normalize color channels. |
cnorm_across | If true and color_norm is true, color is normalized across each other, rather than layer by layer. |
keep_aspect_ratio | If true (default), aspect ratio is kept. |
void ebl::laplacian_pyramid_module< T, Tstate >::blur | ( | idx< T > & | filter, |
idx< T > & | in, | ||
idx< T > & | out, | ||
rect< int > & | roi | ||
) | [protected] |
Blur 'in' into 'out' using blurring filter 'filter'.
roi | The region of interest, to be reduced if no padding is used. |
mfidxdim ebl::laplacian_pyramid_module< T, Tstate >::bprop_size | ( | mfidxdim & | osize | ) | [virtual] |
Returns input dimensions corresponding to output dimensions 'osize'. Implementation of this method helps automatic scaling of input data but is optional.
Reimplemented from ebl::resizepp_module< T, Tstate >.
void ebl::laplacian_pyramid_module< T, Tstate >::fprop | ( | Tstate & | in, |
midx< T > & | out | ||
) | [virtual] |
Process 'in' into 'out' which will contain an array of idx, where each idx has different scale with different dimensions.
Reimplemented from ebl::resizepp_module< T, Tstate >.
void ebl::laplacian_pyramid_module< T, Tstate >::fprop | ( | Tstate & | in, |
mstate< Tstate > & | out | ||
) | [virtual] |
Process 'in' into 'out' which will contain all scales separated in each state of the multi-state 'out'.
Reimplemented from ebl::s2m_module< T, Tstate >.
mfidxdim ebl::laplacian_pyramid_module< T, Tstate >::fprop_size | ( | mfidxdim & | isize | ) | [virtual] |
Modifies multi-input dimensions 'isize' to be compliant with module's architecture, and returns corresponding output dimensions. Implementation of this method helps automatic scaling of input data but is optional.
Reimplemented from ebl::module_1_1< T, Tin, Tout >.
idx< T > ebl::laplacian_pyramid_module< T, Tstate >::highpass | ( | idx< T > & | in, |
idx< T > & | blurred, | ||
idxdim & | tgt, | ||
rect< int > & | inr, | ||
bool | first | ||
) | [protected] |
Highpass 'in' by subtracting 'blurred' version of the image into a new buffer and return it. The input region 'inr' will be centered in the returned buffer. The returned buffer will have 'tgt' dimensions.
first | It is the first time highpass is called or not. |
void ebl::laplacian_pyramid_module< T, Tstate >::normalize_globally | ( | idx< T > & | in | ) | [protected] |
Normalize entire 'in' image, using mean and standard deviation of the region of interest of 'roi' of the image. Intensity (0) and color channels (1 & 2) are normalized independently. Normalizing from the ROI only can be important, if the non-ROI contains zero-padding.
void ebl::laplacian_pyramid_module< T, Tstate >::set_scalings | ( | vector< float > & | scalings | ) | [virtual] |
Produce multiple pyramids, each starting at a scaling of the original input.
void ebl::laplacian_pyramid_module< T, Tstate >::subsample | ( | idx< T > & | in, |
idx< T > & | out, | ||
rect< int > & | inr | ||
) | [protected] |
Subsample 'in' into 'out' with a factor of 2. If 'in' dimensions are not a factor of 2, the last odd row or column are simply dropped. This downsamples 'inr' accordingly.