32#define BLENDER_OP "BlenderOp Markus.Peura@iki.fi" 
   36#include "DistanceTransformOp.h" 
   37#include "DistanceTransformFillOp.h" 
   38#include "FastAverageOp.h" 
   39#include "FlowAverageWindowOp.h" 
   40#include "GaussianAverageOp.h" 
   41#include "QualityMixerOp.h" 
   42#include "QualityOverrideOp.h" 
   44#include "drain/util/FunctorPack.h" 
  105    BlenderOp(
int width=5, 
int height=0, 
const std::string & spreader=
"avg", 
const std::string & blender=
"max",
 
  106            unsigned short loops=1, 
double expansionCoeff=1.0) :  
 
  107        WindowOp<>(__FUNCTION__, 
"Smoothes image repeatedly, mixing original image with the result at each round.", width, height){
 
  108        parameters.link(
"spreader", this->spreader = spreader, getSmootherAliasMap<false>().toStr()); 
 
  109        parameters.link(
"mix", this->blender = blender, 
"max|<coeff>: (quality) max, (quality) blend");
 
  110        parameters.link(
"loops", this->loops = loops, 
"number of repetitions");
 
  111        parameters.link(
"expansionCoeff", this->expansionCoeff = expansionCoeff, 
"window enlargement");
 
 
  116        parameters.
copyStruct(op.getParameters(), op, *
this);
 
  122    const std::string & getSmootherKey(){
 
  128        if (conf.frame.height == 0){
 
  129            conf.frame.height = conf.frame.width;
 
 
  150    const std::string & 
getName()
 const override {
 
 
  158    template <
bool WEIGHTED=false>
 
  162        if (aliasMap.empty()){
 
  172            aliasMap[
"avg"] = 
"average";
 
  173            aliasMap[
"avgFlow"] = 
"flowAverage"; 
 
  174            aliasMap[
"avgGauss"] = 
"gaussianAverage";
 
  175            aliasMap[
"dist"] = WEIGHTED ? 
"distanceTransformFill"    : 
"distanceTransform";
 
  176            aliasMap[
"distExp"] = WEIGHTED ? 
"distanceTransformFillExp" : 
"distanceTransformExp";
 
 
  181    template <
bool WEIGHTED=false>
 
  188        aliasMap[
"blend"] = WEIGHTED ? 
"qualityMixer"    : 
"mix";
 
  189        aliasMap[
"max"]   = WEIGHTED ? 
"qualityOverride" : 
"max";
 
  195    std::string spreader;
 
  200    unsigned short loops = 1;
 
  202    double expansionCoeff = 1.0;
 
 
void copyStruct(const ReferenceMap &m, const T &src, T &dst, extLinkPolicy policy=RESERVE)
Experimental. Copies references and values of a structure to another.
Definition ReferenceMap.h:407
A base class for smart maps providing methods for importing and exporting values, among others.
Definition SmartMap.h:66
Smoothes image and mixes the result with the original.
Definition BlenderOp.h:94
virtual const std::string & getName() const override
Return the name of an instance.
Definition BlenderOp.h:150
void traverseChannels(const ImageTray< const Channel > &src, ImageTray< Channel > &dst) const
Main operation, requires weighted image data.
Definition BlenderOp.cpp:44
virtual void traverseChannel(const Channel &src, Channel &dst) const
Force multi-channel processing.
Definition BlenderOp.h:139
static const drain::SmartMap< std::string > & getSmootherAliasMap()
Definition BlenderOp.h:160
virtual void initializeParameters(const ImageFrame &src, const ImageFrame &dst) const
Set applicable internal parameters before calling traverse().
Definition BlenderOp.h:127
BlenderOp(int width=5, int height=0, const std::string &spreader="avg", const std::string &blender="max", unsigned short loops=1, double expansionCoeff=1.0)
Default constructor.
Definition BlenderOp.h:105
void traverseChannel(const Channel &src, const Channel &srcWeight, Channel &dst, Channel &dstWeight) const
Force multi-channel processing.
Definition BlenderOp.h:145
Image with static geometry.
Definition ImageChannel.h:60
Image with static geometry.
Definition ImageFrame.h:64
void traverseAsChannelTrays(const ImageFrame &src, ImageFrame &dst) const
Redirect to processing as trays. This is the opposite of processChannels...() functions.
Definition ImageOp.h:216
Container applicable for Channels and Images, with alpha support.
Definition ImageTray.h:267
Definition DataSelector.cpp:1277