Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
enblend Namespace Reference

Classes

struct  FromPromotePlusFunctorWrapper
 

Functions

template<typename ImagePixelComponentType >
unsigned int filterHalfWidth (const unsigned int levels)
 Calculate the half-width of a n-level filter. More...
 
template<typename SKIPSMImagePixelType , typename SKIPSMAlphaPixelType , typename SrcImageIterator , typename SrcAccessor , typename AlphaIterator , typename AlphaAccessor , typename DestImageIterator , typename DestAccessor , typename DestAlphaIterator , typename DestAlphaAccessor >
void reduce (bool wraparound, SrcImageIterator src_upperleft, SrcImageIterator src_lowerright, SrcAccessor sa, AlphaIterator alpha_upperleft, AlphaAccessor aa, DestImageIterator dest_upperleft, DestImageIterator dest_lowerright, DestAccessor da, DestAlphaIterator dest_alpha_upperleft, DestAlphaIterator dest_alpha_lowerright, DestAlphaAccessor daa)
 The Burt & Adelson Reduce operation. More...
 
template<typename SKIPSMImagePixelType , typename SKIPSMAlphaPixelType , typename SrcImageIterator , typename SrcAccessor , typename AlphaIterator , typename AlphaAccessor , typename DestImageIterator , typename DestAccessor , typename DestAlphaIterator , typename DestAlphaAccessor >
void reduce (bool wraparound, triple< SrcImageIterator, SrcImageIterator, SrcAccessor > src, pair< AlphaIterator, AlphaAccessor > mask, triple< DestImageIterator, DestImageIterator, DestAccessor > dest, triple< DestAlphaIterator, DestAlphaIterator, DestAlphaAccessor > destMask)
 
template<typename SKIPSMImagePixelType , typename SrcImageIterator , typename SrcAccessor , typename DestImageIterator , typename DestAccessor >
void reduce (bool wraparound, SrcImageIterator src_upperleft, SrcImageIterator src_lowerright, SrcAccessor sa, DestImageIterator dest_upperleft, DestImageIterator dest_lowerright, DestAccessor da)
 The Burt & Adelson Reduce operation. More...
 
template<typename SKIPSMImagePixelType , typename SrcImageIterator , typename SrcAccessor , typename DestImageIterator , typename DestAccessor >
void reduce (bool wraparound, triple< SrcImageIterator, SrcImageIterator, SrcAccessor > src, triple< DestImageIterator, DestImageIterator, DestAccessor > dest)
 
template<typename SKIPSMImagePixelType , typename SrcImageIterator , typename SrcAccessor , typename DestImageIterator , typename DestAccessor , typename CombineFunctor >
void expand (bool add, bool wraparound, SrcImageIterator src_upperleft, SrcImageIterator src_lowerright, SrcAccessor sa, DestImageIterator dest_upperleft, DestImageIterator dest_lowerright, DestAccessor da, CombineFunctor cf)
 The Burt & Adelson Expand operation. More...
 
template<typename SKIPSMImagePixelType , typename SrcImageIterator , typename SrcAccessor , typename DestImageIterator , typename DestAccessor >
void expand (bool add, bool wraparound, triple< SrcImageIterator, SrcImageIterator, SrcAccessor > src, triple< DestImageIterator, DestImageIterator, DestAccessor > dest)
 

Function Documentation

template<typename SKIPSMImagePixelType , typename SrcImageIterator , typename SrcAccessor , typename DestImageIterator , typename DestAccessor , typename CombineFunctor >
void enblend::expand ( bool  add,
bool  wraparound,
SrcImageIterator  src_upperleft,
SrcImageIterator  src_lowerright,
SrcAccessor  sa,
DestImageIterator  dest_upperleft,
DestImageIterator  dest_lowerright,
DestAccessor  da,
CombineFunctor  cf 
)

The Burt & Adelson Expand operation.

Upsampling with Gaussian interpolation in one pass over the input image using SKIPSM-based algorithm. Uses only integer math, visits each pixel only once.

Explanation of algorithm:

src image pixels: a b c dst image pixels: A B C D E F G H I J d e f K L M N O P Q R S T g h i U V W X Y

Algorithm visits all src image pixels from left to right and top to bottom. At each src pixel, four dst pixels are calculated. When visiting src pixel i, dst pixels M, N, R and S are written.

State variables before visiting i: sr0 = h sr1 = g sc0a[2] = d + 6e + f sc0b[2] = 4e + 4f sc1a[2] = a + 6b + c sc1b[2] = 4b + 4c

State variables after visiting i: sr0 = i sr1 = h sc0a[2] = g + 6h + i sc0b[2] = 4h + 4i sc1a[2] = d + 6e + f sc1b[2] = 4e + 4f

M = 1 * (a + 6b + c)

  • 6 * (d + 6e + f)
  • 1 * (g + 6h + i)

N = 1 * (4b + 4c)

  • 6 * (4e + 4f)
  • 1 * (4h + 4i)

R = 4 * (d + 6e + f)

  • 4 * (g + 6h + i)

S = 4 * (4e + 4f)

  • 4 * (4h + 4i)

Updates when visiting each src image pixel: (all assignments occur in parallel) sr0 <= current sr1 <= sr0 sc0a[x] <= sr1 + 6*sr0 + current sc0b[x] <= 4*sr0 + 4*current sc1a[x] <= sc0a[x] sc1b[x] <= sc0b[x] out(-2, -2) <= sc1a[x] + 6*sc0a[x] + (new sc0a[x]) out(-1, -2) <= sc1b[x] + 6*sc0b[x] + (new sc0b[x]) out(-2, -1) <= 4*sc0a[x] + 4*(new sc0a[x]) out(-1, -1) <= 4*sc0b[x] + 4*(new sc0b[x])

Definition at line 1089 of file pyramid2.h.

References IMUL6, SKIPSM_EXPAND, SKIPSM_EXPAND_COLUMN_END, SKIPSM_EXPAND_COLUMN_END_WRAPAROUND, SKIPSM_EXPAND_ROW_COLUMN_END, SKIPSM_EXPAND_ROW_END, and SKIPSM_EXPAND_SHIFT.

template<typename SKIPSMImagePixelType , typename SrcImageIterator , typename SrcAccessor , typename DestImageIterator , typename DestAccessor >
void enblend::expand ( bool  add,
bool  wraparound,
triple< SrcImageIterator, SrcImageIterator, SrcAccessor >  src,
triple< DestImageIterator, DestImageIterator, DestAccessor >  dest 
)
inline

Definition at line 1368 of file pyramid2.h.

template<typename ImagePixelComponentType >
unsigned int enblend::filterHalfWidth ( const unsigned int  levels)

Calculate the half-width of a n-level filter.

Assumes that the input function is a left-handed function, and the last non-zero input is at location 0. Returns the location of the last non-zero output.

Definition at line 69 of file pyramid2.h.

template<typename SKIPSMImagePixelType , typename SKIPSMAlphaPixelType , typename SrcImageIterator , typename SrcAccessor , typename AlphaIterator , typename AlphaAccessor , typename DestImageIterator , typename DestAccessor , typename DestAlphaIterator , typename DestAlphaAccessor >
void enblend::reduce ( bool  wraparound,
SrcImageIterator  src_upperleft,
SrcImageIterator  src_lowerright,
SrcAccessor  sa,
AlphaIterator  alpha_upperleft,
AlphaAccessor  aa,
DestImageIterator  dest_upperleft,
DestImageIterator  dest_lowerright,
DestAccessor  da,
DestAlphaIterator  dest_alpha_upperleft,
DestAlphaIterator  dest_alpha_lowerright,
DestAlphaAccessor  daa 
)
inline

The Burt & Adelson Reduce operation.

This version is for images with alpha channels. Gaussian blur, downsampling, and extrapolation in one pass over the input image using SKIPSM-based algorithm. Uses only integer math, visits each pixel only once.

Reference: Frederick M. Waltz and John W.V. Miller. An efficient algorithm for Gaussian blur using finite-state machines. SPIE Conf. on Machine Vision Systems for Inspection and Metrology VII. November 1998.


1-D explanation of algorithm:

src image pixels: A B C D E F G dst image pixels: W X Y Z

Algorithm iterates over src image pixels from left to right. At even src image pixels, the output of the previous dst image pixel is calculated. For example, when visiting E, the value of X is written to the dst image.

State variables before visiting E: sr0 = C sr1 = A + 4B srp = 4D

State variables after visiting E: sr0 = E sr1 = C + 4D srp = 4D X = A + 4B + 6C + 4D + E

Updates when visiting even source pixel: (all updates occur in parallel) sr0 <= current sr1 <= sr0 + srp dst(-1) <= sr1 + 6*sr0 + srp + current

Updates when visiting odd source pixel: srp <= 4*current


2-D explanation:

src image pixels: A B C D E dst image pixels: a b c F G H I J K L M N O d e f P Q R S T U V W X Y g h i

Algorithm visits all src image pixels from left to right and top to bottom. When visiting src pixel Y, the value of e will be written to the dst image.

State variables before visiting Y: sr0 = W sr1 = U + 4V srp = 4X sc0[2] = K + 4L + 6M + 4N + O sc1[2] = (A + 4B + 6C + 4D + E) + 4*(F + 4G + 6H + 4I + J) scp[2] = 4*(P + 4Q + 6R + 4S + T)

State variables after visiting Y: sr0 = Y sr1 = W + 4X srp = 4X sc0[2] = U + 4V + 6W + 4X + Y sc1[2] = (K + 4L + 6M + 4N + O) + 4*(P + 4Q + 6R + 4S + T) scp[2] = 4*(P + 4Q + 6R + 4S + T) e = 1 * (A + 4B + 6C + 4D + E)

  • 4 * (F + 4G + 6H + 4I + J)
  • 6 * (K + 4L + 6M + 4N + O)
  • 4 * (P + 4Q + 6R + 4S + T)
  • 1 * (U + 4V + 6W + 4X + Y)

Updates when visiting (even x, even y) source pixel: (all updates occur in parallel) sr0 <= current sr1 <= sr0 + srp sc0[x] <= sr1 + 6*sr0 + srp + current sc1[x] <= sc0[x] + scp[x] dst(-1,-1) <= sc1[x] + 6*sc0[x] + scp + (new sc0[x])

Updates when visiting (odd x, even y) source pixel: srp <= 4*current

Updates when visiting (even x, odd y) source pixel: sr0 <= current sr1 <= sr0 + srp scp[x] <= 4*(sr1 + 6*sr0 + srp + current)

Updates when visting (odd x, odd y) source pixel: srp <= 4*current

Definition at line 178 of file pyramid2.h.

References AMUL6, IMUL6, and celeste::max().

Referenced by reduceFilesToHDR(), vigra_ext::reduceROIImages(), and HuginBase::Nona::ReduceStitcher< ImageType, AlphaType >::stitch().

template<typename SKIPSMImagePixelType , typename SKIPSMAlphaPixelType , typename SrcImageIterator , typename SrcAccessor , typename AlphaIterator , typename AlphaAccessor , typename DestImageIterator , typename DestAccessor , typename DestAlphaIterator , typename DestAlphaAccessor >
void enblend::reduce ( bool  wraparound,
triple< SrcImageIterator, SrcImageIterator, SrcAccessor >  src,
pair< AlphaIterator, AlphaAccessor >  mask,
triple< DestImageIterator, DestImageIterator, DestAccessor >  dest,
triple< DestAlphaIterator, DestAlphaIterator, DestAlphaAccessor >  destMask 
)
inline

Definition at line 579 of file pyramid2.h.

template<typename SKIPSMImagePixelType , typename SrcImageIterator , typename SrcAccessor , typename DestImageIterator , typename DestAccessor >
void enblend::reduce ( bool  wraparound,
SrcImageIterator  src_upperleft,
SrcImageIterator  src_lowerright,
SrcAccessor  sa,
DestImageIterator  dest_upperleft,
DestImageIterator  dest_lowerright,
DestAccessor  da 
)
inline

The Burt & Adelson Reduce operation.

This version is for images that do not have alpha channels.

Definition at line 597 of file pyramid2.h.

References IMUL11, IMUL5, and IMUL6.

template<typename SKIPSMImagePixelType , typename SrcImageIterator , typename SrcAccessor , typename DestImageIterator , typename DestAccessor >
void enblend::reduce ( bool  wraparound,
triple< SrcImageIterator, SrcImageIterator, SrcAccessor >  src,
triple< DestImageIterator, DestImageIterator, DestAccessor >  dest 
)
inline

Definition at line 853 of file pyramid2.h.