Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ConvolutionPyramid Class Reference

Implements a multiscale scheme for approximating convolution with large filters. This is the basis of the technique described in Convolution Pyramids, Farbman et al., 2011. A set of filter parameters can be estimated through an offline optimization for each desired task: gradient field integration, seamless image cloning, background filling, or scattered data interpolation. More...

#include <ConvolutionPyramid.hpp>

Public Member Functions

 ConvolutionPyramid (uint width, uint height, uint inoutPadding)
 
void setFilters (const float h1[5], float h2, const float g[3])
 
void process (const Texture &texture)
 
void resize (uint width, uint height)
 
const Texturetexture () const
 
unsigned int width ()
 
unsigned int height ()
 

Private Attributes

Program_downscale
 Pyramid descending pass shader.
 
Program_upscale
 Pyramid ascending pass shader.
 
Program_filter
 Filtering shader for the last pyramid level.
 
Program_padder
 Padding helper shader.
 
Texture _shifted
 Contains the input data padded to the right size.
 
std::vector< Texture_levelsIn
 The initial levels of the pyramid.
 
std::vector< Texture_levelsOut
 The filtered levels of the pyramid.
 
float _h1 [5] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f}
 h1 filter coefficients.
 
float _h2 = 0.0f
 h2 filter multiplier.
 
float _g [3] = {0.0f, 0.0f, 0.0f}
 g filter coefficients.
 
glm::ivec2 _resolution = glm::ivec2(0)
 Resolution expected for the input texture.
 
const int _size = 5
 Size of the filter.
 
int _padding = 0
 Additional padding.
 

Detailed Description

Implements a multiscale scheme for approximating convolution with large filters. This is the basis of the technique described in Convolution Pyramids, Farbman et al., 2011. A set of filter parameters can be estimated through an offline optimization for each desired task: gradient field integration, seamless image cloning, background filling, or scattered data interpolation.

Constructor & Destructor Documentation

◆ ConvolutionPyramid()

ConvolutionPyramid::ConvolutionPyramid ( uint  width,
uint  height,
uint  inoutPadding 
)

Constructor.

Parameters
widthinternal processing width
heightinternal processing height
inoutPaddingadditional padding applied everywhere except on the final result texture
Note
This is mainly used for the gradient integration task.

Member Function Documentation

◆ height()

unsigned int ConvolutionPyramid::height ( )
inline

Returns the height expected for the input texture.

Returns
the height expected

◆ process()

void ConvolutionPyramid::process ( const Texture texture)

Filter a given input texture.

Parameters
texturethe GPU ID of the texture
Note
Those filters are separable, and could be applied in two passes (vertical and horizontal) to reduce the texture fetches count.

◆ resize()

void ConvolutionPyramid::resize ( uint  width,
uint  height 
)

Resize the internal buffers.

Parameters
widththe new width
heightthe new height

◆ setFilters()

void ConvolutionPyramid::setFilters ( const float  h1[5],
float  h2,
const float  g[3] 
)

Setup the filters parameters for a given task.

Parameters
h1the 5 coefficients of h1
h2the multiplier coefficient h2
gthe 3 coefficients of g
Note
See Convolution Pyramids, Farbman et al., 2011 for the notation details.

◆ texture()

const Texture * ConvolutionPyramid::texture ( ) const
inline

The GPU ID of the filter result.

Returns
the ID of the result texture

◆ width()

unsigned int ConvolutionPyramid::width ( )
inline

Returns the width expected for the input texture.

Returns
the width expected

The documentation for this class was generated from the following files: