Image Component Library (ICL)
CCLUT.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 : ICLCore/src/ICLCore/CCLUT.h **
10 ** Module : ICLCore **
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 <ICLCore/Img.h>
36 #include <vector>
37 #include <string>
38 
39 namespace icl{
40  namespace core{
41 
43  public:
44  CCLUT(format srcFmt, format dstFmt);
45  void cc(const ImgBase *src, ImgBase *dst, bool roiOnly=false);
46 
47  private:
49  // format m_eSrcFmt;
50  // format m_eDstFmt;
51  };
52 
53 
56 
63  /******************
64  class CCLUT{
65  static const int OFS1 = 256;
66  static const int OFS2 = 65536;
67 
68  public:
69  CCLUT(format srcFmt, format dstFmt){
70  m_iSrcChan = getChannelsOfFormat(srcFmt);
71  m_iDstChan = getChannelsOfFormat(dstFmt);
72 
73  int DIM = (int)pow(256,m_iSrcChan);
74 
75  // alloc lut
76  memset(m_apucLUT,0,3*sizeof(icl8u*));
77  for(int i=0;i<m_iDstChan;++i){
78  m_apucLUT[i] = new icl8u[DIM];
79  }
80 
82  Img8u bufSrc(Size(256*256*256,3),srcFmt);
83  Img8u bufDst(Size(256*256*256,3),dstFmt);
84 
85  for(int r=0;r<256;r++){
86  std::fill(bufSrc.getData(0)+r*OFS2, bufSrc.getData(0)+(r+1)*OFS2, icl8u(r));
87  icl8u *pg = bufSrc.getData(1)+r*OFS2;
88  for(int g=0;g<256;g++){
89  std::fill(pg+g*OFS1,pg+(g+1)*OFS1, icl8u(g));
90  icl8u *pb = bufSrc.getData(2)+r*OFS2 + g*OFS1;
91  for(int b=0;b<256;b++){
92  pb[b] = icl8u(b);
93  }
94  }
95  }
96  }
97  icl8u *m_apucLUT[3];
98 
99  inline void convert3to3(const icl8u &s1,
100  const icl8u &s2,const
101  icl8u &s3, icl8u s1,
102  icl8u &d1, icl8u &d2, icl8u &d3){
103  int idx = s1+OFS1*s2+OFS3*s3;
104  d1 = m_apucLUT[0][idx];
105  d2 = m_apucLUT[1][idx];
106  d3 = m_apucLUT[2][idx];
107  }
108  };
109  */
110  } // namespace core
111 }
Img8u m_oLUT
Definition: CCLUT.h:48
undocument this line if you encounter any issues!
Definition: Any.h:37
ICLCore_API void cc(const ImgBase *src, ImgBase *dst, bool roiOnly=false)
Color conversion from source to destination image.
format
determines the color-format, that is associated with the images channels
Definition: Types.h:70
Definition: CCLUT.h:42
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
#define ICLCore_API
Definition: CompatMacros.h:174