Image Component Library (ICL)
RunLengthEncoder.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 : ICLCV/src/ICLCV/RunLengthEncoder.h **
10 ** Module : ICLCV **
11 ** Authors: Christof Elbrechter, Erik Weitnauer **
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 
32 #pragma once
33 
34 #include <ICLUtils/CompatMacros.h>
35 #include <ICLUtils/Size.h>
36 #include <ICLUtils/Uncopyable.h>
37 #include <ICLCore/Img.h>
39 #include <vector>
40 
41 namespace icl {
42  namespace cv{
43 
45 
103 
105  std::vector<WLS> m_data;
106 
108  std::vector<WLS*> m_ends;
109 
112 
114  template<class T>
115  void encode_internal(const core::Img<T> &image);
116 
118  void prepare(const utils::Rect &roi);
119 
121  void resetLineSegments();
122 
123  public:
124 
126  void encode(const core::ImgBase *image);
127 
129 
130  inline WorkingLineSegment *begin(int row){
131  return &m_data[row*m_imageROI.width];
132  }
133 
135 
136  inline const WorkingLineSegment *begin(int row) const{
137  return &m_data[row*m_imageROI.width];
138  }
139 
141 
142  inline WorkingLineSegment *end(int row){
143  return m_ends[row];
144  }
145 
147 
148  inline const WorkingLineSegment *end(int row) const {
149  return m_ends[row];
150  }
151  };
152 
153  } // namespace cv
154 }
155 
const WorkingLineSegment * begin(int row) const
Returns a begin()-pointer for the first encoded image line (const)
Definition: RunLengthEncoder.h:136
undocument this line if you encounter any issues!
Definition: Any.h:37
ICLQt_API ImgROI roi(ImgQ &r)
creates a ROI-struct from an image
std::vector< WLS * > m_ends
internal buffer for line ends
Definition: RunLengthEncoder.h:108
WorkingLineSegment WLS
internal typedef
Definition: RunLengthEncoder.h:102
utils::Rect m_imageROI
current image ROI, the RunLengthEncoder is optimized for (adatped automatically)
Definition: RunLengthEncoder.h:111
WorkingLineSegment * begin(int row)
Returns a begin()-pointer for the first encoded image line.
Definition: RunLengthEncoder.h:130
#define ICLCV_API
Definition: CompatMacros.h:177
WorkingLineSegment * end(int row)
Returns a end()-pointer for the first encoded image line.
Definition: RunLengthEncoder.h:142
std::vector< WLS > m_data
internal data buffer
Definition: RunLengthEncoder.h:105
Simple class for creation of a run-length encoding of an image.
Definition: RunLengthEncoder.h:100
The working line segment class extends the LineSegment class by some working parameters.
Definition: WorkingLineSegment.h:47
const WorkingLineSegment * end(int row) const
Returns a end()-pointer for the first encoded image line (const)
Definition: RunLengthEncoder.h:148
Rectangle class of the ICL used e.g. for the Images ROI-rect.
Definition: Rect.h:95
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131