Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CCLUT.h
Go to the documentation of this file.
00001 /********************************************************************
00002 **                Image Component Library (ICL)                    **
00003 **                                                                 **
00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld          **
00005 **                         Neuroinformatics Group                  **
00006 ** Website: www.iclcv.org and                                      **
00007 **          http://opensource.cit-ec.de/projects/icl               **
00008 **                                                                 **
00009 ** File   : ICLCore/src/ICLCore/CCLUT.h                            **
00010 ** Module : ICLCore                                                **
00011 ** Authors: Christof Elbrechter                                    **
00012 **                                                                 **
00013 **                                                                 **
00014 ** GNU LESSER GENERAL PUBLIC LICENSE                               **
00015 ** This file may be used under the terms of the GNU Lesser General **
00016 ** Public License version 3.0 as published by the                  **
00017 **                                                                 **
00018 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
00019 ** included in the packaging of this file.  Please review the      **
00020 ** following information to ensure the license requirements will   **
00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt                **
00022 **                                                                 **
00023 ** The development of this software was supported by the           **
00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology.    **
00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche       **
00026 ** Forschungsgemeinschaft (DFG) in the context of the German       **
00027 ** Excellence Initiative.                                          **
00028 **                                                                 **
00029 ********************************************************************/
00030 
00031 #pragma once
00032 
00033 #include <ICLUtils/CompatMacros.h>
00034 #include <ICLCore/Img.h>
00035 #include <ICLUtils/ConsoleProgress.h>
00036 #include <vector>
00037 #include <string>
00038 
00039 namespace icl{
00040   namespace core{
00041   
00042     class ICLCore_API CCLUT{
00043       public:
00044       CCLUT(format srcFmt, format dstFmt);
00045       void cc(const ImgBase *src, ImgBase *dst, bool roiOnly=false);
00046       
00047       private:
00048       Img8u m_oLUT;
00049       // format m_eSrcFmt;
00050       // format m_eDstFmt;
00051     };
00052     
00053     
00056 
00063     /******************
00064         class CCLUT{
00065         static const int OFS1 = 256;
00066         static const int OFS2 = 65536;
00067         
00068         public:
00069         CCLUT(format srcFmt, format dstFmt){
00070         m_iSrcChan = getChannelsOfFormat(srcFmt);
00071         m_iDstChan = getChannelsOfFormat(dstFmt);
00072         
00073         int DIM = (int)pow(256,m_iSrcChan);
00074         
00075         // alloc lut
00076         memset(m_apucLUT,0,3*sizeof(icl8u*));
00077         for(int i=0;i<m_iDstChan;++i){
00078         m_apucLUT[i] = new icl8u[DIM];
00079         }
00080         
00082         Img8u bufSrc(Size(256*256*256,3),srcFmt);
00083         Img8u bufDst(Size(256*256*256,3),dstFmt);
00084         
00085         for(int r=0;r<256;r++){
00086         std::fill(bufSrc.getData(0)+r*OFS2, bufSrc.getData(0)+(r+1)*OFS2, icl8u(r));
00087         icl8u *pg = bufSrc.getData(1)+r*OFS2;
00088         for(int g=0;g<256;g++){
00089         std::fill(pg+g*OFS1,pg+(g+1)*OFS1, icl8u(g));
00090         icl8u *pb = bufSrc.getData(2)+r*OFS2 + g*OFS1;
00091         for(int b=0;b<256;b++){
00092         pb[b] = icl8u(b);
00093         }
00094         }
00095         }
00096         }
00097         icl8u *m_apucLUT[3];
00098         
00099         inline void convert3to3(const icl8u &s1,
00100         const icl8u &s2,const 
00101         icl8u &s3, icl8u s1, 
00102         icl8u &d1, icl8u &d2, icl8u &d3){
00103         int idx = s1+OFS1*s2+OFS3*s3;
00104         d1 = m_apucLUT[0][idx];
00105         d2 = m_apucLUT[1][idx];
00106         d3 = m_apucLUT[2][idx];
00107         }
00108         };
00109         */
00110   } // namespace core
00111 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines