31 #ifndef DRAIN_IMAGE_OP_BANK_H_
32 #define DRAIN_IMAGE_OP_BANK_H_
39 #include <drain/RegExp.h>
41 #include "drain/util/Bank.h"
42 #include "drain/util/FunctorPack.h"
45 #include "FunctorOp.h"
47 #include "drain/prog/Command.h"
48 #include "drain/prog/CommandBank.h"
50 #include "drain/util/Cloner.h"
51 #include "drain/util/Fuzzy.h"
57 #include "RunLengthOp.h"
59 #include "BlenderOp.h"
61 #include "CatenatorOp.h"
64 #include "DistanceTransformFillOp.h"
65 #include "DistanceTransformOp.h"
66 #include "FastAverageOp.h"
68 #include "FlowAverageWindowOp.h"
69 #include "FloodFillOp.h"
70 #include "FunctorOp.h"
72 #include "GaussianAverageOp.h"
73 #include "DifferentialOp.h"
74 #include "HighBoostOp.h"
75 #include "HighPassOp.h"
76 #include "ImpulseAvgOp.h"
77 #include "MarginalStatisticOp.h"
80 #include "MultiThresholdOp.h"
81 #include "PaletteOp.h"
82 #include "PixelVectorOp.h"
83 #include "QualityMixerOp.h"
84 #include "QualityOverrideOp.h"
85 #include "QuantizatorOp.h"
87 #include "RunLengthOp.h"
88 #include "SegmentAreaOp.h"
89 #include "SegmentStatisticsOp.h"
90 #include "SlidingWindowHistogramOp.h"
91 #include "SlidingWindowMedianOp.h"
92 #include "SlidingWindowOp.h"
93 #include "TransposeOp.h"
96 #include "SuperProberOp.h"
110 const std::string & getName(){
133 NegateOp() :
ImageOp(__FUNCTION__,
"Invert values (unsigned char or unsigned short int)"){
146 double srcMax = src.getConf().
getTypeMax<
double>();
147 double dstMax = dst.getConf().
getTypeMax<
double>();
148 double rescale = dstMax/srcMax;
153 while (d != dst.
end()){
154 *d = dstMax - rescale*
static_cast<double>(*s);
184 OP &
install(
const std::string & name = OP().getName()){
188 std::string key(name);
190 mout.
warn() << name <<
">" << OP().getName() <<
'>' << key <<
'\n';
204 std::ostream & operator<<(std::ostream & ostr,
const ImageOpBank & bank);
218 installer.template install<NegateOp>();
219 installer.template install<UnaryFunctorOp<ScalingFunctor> >(
"Rescale");
221 installer.template install<UnaryFunctorOp<RemappingFunctor> >(
"Remap");
222 installer.template install<UnaryFunctorOp<ThresholdFunctor> >();
223 installer.template install<UnaryFunctorOp<BinaryThresholdFunctor> >(
"ThresholdBinary");
227 installer.template install<BinaryFunctorOp<AdditionFunctor> >(
"Add");
228 installer.template install<BinaryFunctorOp<DivisionFunctor> >(
"Div");
229 installer.template install<BinaryFunctorOp<MaximumFunctor> >(
"Max");
230 installer.template install<BinaryFunctorOp<MinimumFunctor> >(
"Min");
231 installer.template install<BinaryFunctorOp<MixerFunctor> >(
"Mix");
232 installer.template install<BinaryFunctorOp<MultiplicationFunctor> >(
"Mul");
233 installer.template install<BinaryFunctorOp<SubtractionFunctor> >(
"Sub");
237 installer.template install<UnaryFunctorOp<FuzzyBell<double>,
true> >();
238 installer.template install<UnaryFunctorOp<FuzzyBell2<double>,
true> >();
239 installer.template install<UnaryFunctorOp<FuzzyStep<double>,
true> >();
240 installer.template install<UnaryFunctorOp<FuzzyStepsoid<double>,
true> >();
241 installer.template install<UnaryFunctorOp<FuzzyTriangle<double>,
true> >();
242 installer.template install<UnaryFunctorOp<FuzzyTwinPeaks<double>,
true> >();
245 installer.template install<ChannelCatenatorOp>(
"Catenate");
247 installer.template install<CopyOp>();
248 installer.template install<CropOp>();
250 installer.template install<DistanceTransformLinearOp>(
"DistanceTransform");
251 installer.template install<DistanceTransformExponentialOp>(
"DistanceTransformExp");
252 installer.template install<DistanceTransformFillLinearOp>(
"DistanceTransformFill");
253 installer.template install<DistanceTransformFillExponentialOp>(
"DistanceTransformFillExp");
255 installer.template install<FastAverageOp>(
"Average");
257 installer.template install<FlowAverageOp>();
259 installer.template install<BlenderOp>();
261 installer.template install<ImpulseResponseOp<ImpulseAvg> >(
"impulseAvg");
267 installer.template install<FloodFillOp>();
270 installer.template install<UnaryFunctorOp<GammaFunctor,true> >();
273 installer.template install<UnaryFunctorOp<QuantizatorFunctor> >();
275 installer.template install<GaussianAverageOp>();
278 installer.template install<GradientOp>();
279 installer.template install<GradientHorzOp>();
280 installer.template install<GradientVertOp>();
281 installer.template install<LaplaceOp>();
282 installer.template install<LaplaceHorzOp>();
283 installer.template install<LaplaceVertOp>();
286 installer.template install<HighBoostOp>();
288 installer.template install<HighPassOp>();
290 installer.template install<MarginalStatisticOp>(
"marginStat");
298 installer.template install<GrayOp>();
299 installer.template install<DistanceOp>();
300 installer.template install<ProductOp>();
301 installer.template install<MagnitudeOp>();
303 installer.template install<MultiThresholdOp>();
311 installer.template install<QualityThresholdOp>();
313 installer.template install<QualityMixerOp>();
315 installer.template install<QualityOverrideOp>();
318 installer.template install<ResizeOp>();
323 installer.template install<RunLengthHorzOp>();
324 installer.template install<RunLengthVertOp>();
326 installer.template install<SegmentAreaOp<float,unsigned short> >();
327 installer.template install<SegmentStatisticsOp>(
"segmentStats");
330 installer.template install<SuperProberOp>();
333 installer.template install<SlidingWindowHistogramOp>(
"windowHistogram");
334 installer.template install<SlidingWindowMedianOp>(
"median");
335 installer.template install<TransposeOp>();
345 }
catch (std::exception & e) {
346 std::cerr <<
"Bank " << e.what() << std::endl;
Definition: CastableIterator.h:57
static void deriveCmdName(std::string &name, char prefix=0)
Given a command class name like MyFileReadCommand, derives a respective command line option ("myFileR...
Definition: CommandBank.cpp:62
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition: Log.h:308
Logger & warn(const TT &... args)
Possible error, but execution can continue.
Definition: Log.h:426
A base class for smart maps providing methods for importing and exporting values, among others.
Definition: SmartMap.h:66
Definition: ImageOpBank.h:124
Image with static geometry.
Definition: ImageChannel.h:60
T getTypeMax() const
Returns the maximum value supported by the current storage type.
Definition: ImageConf.h:281
const iterator & begin()
Returns iterator pointing to the first image element.
Definition: ImageFrame.h:119
const iterator & end()
Returns the iterator pointing to the element after the last element of the image buffer.
Definition: ImageFrame.h:125
Definition: ImageOpBank.h:166
ImageOp & getComplete(const std::string &query, char separator=',', char assign='=', const drain::SmartMap< std::string > &aliasMap=drain::SmartMap< std::string >())
Supports querying operator with parameters set, eg. gaussianAverage,width=10,height=5.
Definition: ImageOpBank.cpp:43
OP & install(const std::string &name=OP().getName())
Add ImageOp command to registry (CommandBank).
Definition: ImageOpBank.h:184
Definition: ImageOpBank.h:106
Base class for image processing functions.
Definition: ImageOp.h:49
void traverseChannelsEqually(const ImageTray< const Channel > &src, ImageTray< Channel > &dst) const
Calls processWithTemp() if the frames overlap.
Definition: ImageOp.cpp:414
ImageOp(const std::string &name=__FUNCTION__, const std::string &description="")
Definition: ImageOp.h:156
Container applicable for Channels and Images, with alpha support.
Definition: ImageTray.h:267
Definition: ImageOpBank.h:129
virtual void traverseChannel(const Channel &src, Channel &dst) const
Apply to single channel.
Definition: ImageOpBank.h:144
Definition: ImageOpBank.h:118
void installImageOps(T &installer)
Definition: ImageOpBank.h:213
ImageOpBank & getImageOpBank()
Definition: ImageOpBank.cpp:124
Definition: DataSelector.cpp:1277
Wrapper for derived class S, returning base class T.
Definition: Cloner.h:117