Image Component Library (ICL)
PylonColorConverter.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 : ICLIO/src/ICLIO/PylonColorConverter.h **
10 ** Module : ICLIO **
11 ** Authors: Viktor Richter **
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 <ICLIO/PylonIncludes.h>
34 
35 #include <ICLUtils/CompatMacros.h>
36 #include <ICLCore/ImgBase.h>
37 #include <ICLCore/Img.h>
38 #include <ICLUtils/Mutex.h>
39 #include <ICLIO/PylonUtils.h>
40 #include <ICLCore/BayerConverter.h>
41 
42 namespace icl {
43  namespace io{
44  namespace pylon {
45 
48  public:
50  virtual ~ColorConverter() {}
52  virtual void initBuffers(ConvBuffers* b) = 0;
54  virtual void convert(const void *imgBuffer, ConvBuffers* b) = 0;
55  };
56 
59  public:
64 
66  void resetConversion(int width, int height, int pixel_size_bits,
67  long buffer_size, Pylon::PixelType pixel_type,
68  std::string pixel_type_name);
70 
73  icl::core::ImgBase* convert(const void *imgBuffer, ConvBuffers* b);
74 
75  private:
81 
85  std::string m_ErrorMessage;
86 
88  void freeAll();
90  void initConversion();
92  void getInfo();
94  void setConversionRGB();
96  void setConversionRGBPacked();
98  void setConversionMono();
99  };
100 
103  public:
105  Mono8uToMono8u(int width, int height);
107  void initBuffers(ConvBuffers* b);
109  void convert(const void *imgBuffer, ConvBuffers* b);
110  private:
111  int m_Width;
112  int m_Height;
113  };
114 
117  public:
119  Mono16sToMono16s(int width, int height);
121  void initBuffers(ConvBuffers* b);
123  void convert(const void *imgBuffer, ConvBuffers* b);
124  private:
125  int m_Width;
126  int m_Height;
127  };
128 
131  public:
133  MonoToMono8u(int width, int height, Pylon::PixelType pixel_type,
134  int pixel_size_bits, long buffer_size);
136  ~MonoToMono8u();
138  void initBuffers(ConvBuffers* b);
140  void convert(const void *imgBuffer, ConvBuffers* b);
141  private:
142  int m_Width;
143  int m_Height;
144  Pylon::PixelType m_PixelType;
148  Pylon::CPixelFormatConverter* m_ColorConverter;
150  Pylon::SImageFormat* m_InputFormat;
152  Pylon::SOutputImageFormat* m_OutputFormat;
153  };
154 
156 
158  public:
160  Rgb8uToRgb8u(int width, int height);
162  void initBuffers(ConvBuffers* b);
164  void convert(const void *imgBuffer, ConvBuffers* b);
165  private:
166  int m_Width;
167  int m_Height;
168  };
169 
172  public:
174  PylonColorToRgb(int width, int height, Pylon::PixelType pixel_type,
175  int pixel_size_bits, long buffer_size);
177  ~PylonColorToRgb();
179  void initBuffers(ConvBuffers* b);
181  void convert(const void *imgBuffer, ConvBuffers* b);
182  private:
183  int m_Width;
184  int m_Height;
185  Pylon::PixelType m_PixelType;
189  Pylon::CPixelFormatConverter* m_ColorConverter;
191  Pylon::SImageFormat* m_InputFormat;
193  Pylon::SOutputImageFormat* m_OutputFormat;
194  };
195 
198  public:
202  utils::Size s);
204  ~BayerToRgb8Icl();
206  void initBuffers(ConvBuffers* b);
208  void convert(const void *imgBuffer, ConvBuffers* b);
209  private:
211  std::vector<icl8u*> m_Channels;
213  };
214 
215  #ifdef ICL_HAVE_IPP
218  public:
220  Yuv422ToRgb8Icl(int width, int height);
222  ~Yuv422ToRgb8Icl();
224  void initBuffers(ConvBuffers* b);
226  void convert(const void *imgBuffer, ConvBuffers* b);
227  private:
230  };
231 
234  public:
236  Yuv422YUYVToRgb8Icl(int width, int height);
240  void initBuffers(ConvBuffers* b);
242  void convert(const void *imgBuffer, ConvBuffers* b);
243  private:
246  };
247  #endif
248 
249  } //namespace
250  } // namespace io
251 } //namespace
252 
virtual void convert(const void *imgBuffer, ConvBuffers *b)=0
writes image from imgBuffer to b using appropriate conversion.
ColorConverter * m_Converter
A pointer to the currently used converter.
Definition: PylonColorConverter.h:79
int m_PixelSize
Definition: PylonColorConverter.h:145
utils::Size m_Size
Definition: PylonColorConverter.h:212
Pure virtual interface for color converters.
Definition: PylonColorConverter.h:47
undocument this line if you encounter any issues!
Definition: Any.h:37
utils::Size m_Size
Definition: PylonColorConverter.h:244
Pylon::PixelType m_PixelType
Definition: PylonColorConverter.h:185
Ipp8u icl8u
8Bit unsigned integer type for the ICL
Definition: BasicTypes.h:64
bayerConverterMethod
Definition: BayerConverter.h:46
This is the color-conversion-class for Pylon images.
Definition: PylonColorConverter.h:58
int m_Height
Definition: PylonColorConverter.h:184
Pylon::SOutputImageFormat * m_OutputFormat
Pylon color core::format converter output format.
Definition: PylonColorConverter.h:193
std::vector< icl8u * > m_Channels
Definition: PylonColorConverter.h:211
long m_BufferSize
Definition: PylonColorConverter.h:146
int m_Width
Definition: PylonColorConverter.h:111
This ColorConverter uses the icl Yuv422YUYV to Rgb conversion.
Definition: PylonColorConverter.h:233
void convert(const void *imgBuffer, ConvBuffers *b)
writes image from imgBuffer to b using appropriate conversion.
bayerPattern
Definition: BayerConverter.h:55
This ColorConverter is used for other pylon-mono to icl-mono8u conversion.
Definition: PylonColorConverter.h:130
Pylon::CPixelFormatConverter * m_ColorConverter
Pylon color core::format converter.
Definition: PylonColorConverter.h:148
icl8u * m_ConvBuffer
Definition: PylonColorConverter.h:229
int m_PixelSize
Definition: PylonColorConverter.h:186
Mono8uToMono8u(int width, int height)
Constructor initializes conversion.
This class holds all buffers needed for ColorConversion.
Definition: PylonUtils.h:108
virtual ~ColorConverter()
Virtual destructor.
Definition: PylonColorConverter.h:50
Pylon::SImageFormat * m_InputFormat
Pylon color core::format converter input format.
Definition: PylonColorConverter.h:150
#define ICLIO_API
Definition: CompatMacros.h:176
Size class of the ICL.
Definition: Size.h:61
Pylon::SOutputImageFormat * m_OutputFormat
Pylon color core::format converter output format.
Definition: PylonColorConverter.h:152
int m_Height
Definition: PylonColorConverter.h:112
int m_Width
Definition: PylonColorConverter.h:125
long m_BufferSize
Definition: PylonColorConverter.h:187
core::BayerConverter m_Conv
Definition: PylonColorConverter.h:210
Pylon::CPixelFormatConverter * m_ColorConverter
Pylon color core::format converter.
Definition: PylonColorConverter.h:189
int m_Width
Definition: PylonColorConverter.h:183
Pylon::PixelType m_PixelType
Definition: PylonColorConverter.h:144
This ColorConverter is used for pylon-mono8u to icl-mono8u conversion.
Definition: PylonColorConverter.h:102
int m_Width
Definition: PylonColorConverter.h:166
utils::Size m_Size
Definition: PylonColorConverter.h:228
icl8u * m_ConvBuffer
Definition: PylonColorConverter.h:245
virtual void initBuffers(ConvBuffers *b)=0
initializes buffers in b as needed for color conversion.
This ColorConverter uses the icl Yuv422 to Rgb conversion.
Definition: PylonColorConverter.h:217
int m_Height
Definition: PylonColorConverter.h:143
utils::Mutex m_Mutex
A mutex lock for concurrency.
Definition: PylonColorConverter.h:77
int m_Height
Definition: PylonColorConverter.h:167
void convert(const srcT *poSrcStart, const srcT *poSrcEnd, dstT *poDst)
moves value from source to destination array (with casting on demand)
Definition: CoreFunctions.h:252
Pylon::SImageFormat * m_InputFormat
Pylon color core::format converter input format.
Definition: PylonColorConverter.h:191
void initBuffers(ConvBuffers *b)
initializes buffers in b as needed for color conversion.
std::string m_ErrorMessage
field for error message
Definition: PylonColorConverter.h:85
Utiltity class for bayer pattern conversion.
Definition: BayerConverter.h:43
This ColorConverter uses the icl Bayer to Rgb conversion.
Definition: PylonColorConverter.h:197
Mutex class of the ICL.
Definition: Mutex.h:54
This ColorConverter is used for pylon-bayer/yuv to icl-rgb conversion.
Definition: PylonColorConverter.h:171
int m_Height
Definition: PylonColorConverter.h:126
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
This ColorConverter is used for pylon-mono16s to icl-mono16s conversion.
Definition: PylonColorConverter.h:116
This ColorConverter is used for pylon-rgb to icl-rgb conversion.
Definition: PylonColorConverter.h:157
int m_Width
Definition: PylonColorConverter.h:142