Image Component Library (ICL)
DitheringOp.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLFilter/src/ICLFilter/DitheringOp.h **
10 ** Module : ICLFilter **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLUtils/Uncopyable.h>
35 #include <ICLFilter/UnaryOp.h>
36 
37 namespace icl{
38  namespace filter{
39 
41 
78  public:
79 
80  enum Algorithm{
81  FloydSteinberg
82  };
84  DitheringOp (Algorithm a=FloydSteinberg, int levels=2);
85 
87  virtual ~DitheringOp(){}
88 
90  void apply (const core::ImgBase *poSrc, core::ImgBase **ppoDst);
91 
93  Algorithm getAlgorithm() const { return m_algorithm; }
94 
96  void setAlgorithm(Algorithm a) { m_algorithm = a; }
97 
99  int getLevels() const { return m_levels; }
100 
102  void setLevels(int l) {
103  if(l<2) l=2;
104  if(l>128) l=128;
105  m_levels = l;
106  }
107 
109  using UnaryOp::apply;
110 
111  private:
113  int m_levels;
114  };
115  } // namespace filter
116 }
117 
118 
undocument this line if you encounter any issues!
Definition: Any.h:37
Class interface for un-copyable classes.
Definition: Uncopyable.h:64
ICLQt_API ImgQ levels(const ImgQ &image, icl8u levels)
reduces an images quantisation levels
void setLevels(int l)
sets the number of quantisation levels
Definition: DitheringOp.h:102
Algorithm
Definition: DitheringOp.h:80
Abstract Base class for Unary Operators.
Definition: UnaryOp.h:51
int getLevels() const
returns the number of quantisation levels
Definition: DitheringOp.h:99
ICLQt_API core::Img< T > filter(const core::Img< T > &image, const std::string &filter)
applies a filter operation on the source image (affinity for float)
virtual ~DitheringOp()
Destructor.
Definition: DitheringOp.h:87
int m_levels
Definition: DitheringOp.h:113
Algorithm getAlgorithm() const
returns the internal dithering algorithm used
Definition: DitheringOp.h:93
void setAlgorithm(Algorithm a)
sets the internal dithering algorithm used
Definition: DitheringOp.h:96
Class that implements dithering mechanisms.
Definition: DitheringOp.h:77
#define ICLFilter_API
Definition: CompatMacros.h:175
virtual void apply(const core::ImgBase *operand1, core::ImgBase **dst)=0
pure virtual apply function, that must be implemented in all derived classes
Algorithm m_algorithm
Definition: DitheringOp.h:112
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131