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.GPL  **
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 <ICLCore/Img.h>
00034 #include <vector>
00035 #include <string>
00036 #include <ICLUtils/ConsoleProgress.h>
00037 
00038 namespace icl{
00039   namespace core{
00040   
00041     class CCLUT{
00042       public:
00043       CCLUT(format srcFmt, format dstFmt);
00044       void cc(const ImgBase *src, ImgBase *dst, bool roiOnly=false);
00045       
00046       private:
00047       Img8u m_oLUT;
00048       // format m_eSrcFmt;
00049       // format m_eDstFmt;
00050     };
00051     
00052     
00055 
00062     /******************
00063         class CCLUT{
00064         static const int OFS1 = 256;
00065         static const int OFS2 = 65536;
00066         
00067         public:
00068         CCLUT(format srcFmt, format dstFmt){
00069         m_iSrcChan = getChannelsOfFormat(srcFmt);
00070         m_iDstChan = getChannelsOfFormat(dstFmt);
00071         
00072         int DIM = (int)pow(256,m_iSrcChan);
00073         
00074         // alloc lut
00075         memset(m_apucLUT,0,3*sizeof(icl8u*));
00076         for(int i=0;i<m_iDstChan;++i){
00077         m_apucLUT[i] = new icl8u[DIM];
00078         }
00079         
00081         Img8u bufSrc(Size(256*256*256,3),srcFmt);
00082         Img8u bufDst(Size(256*256*256,3),dstFmt);
00083         
00084         for(int r=0;r<256;r++){
00085         std::fill(bufSrc.getData(0)+r*OFS2, bufSrc.getData(0)+(r+1)*OFS2, icl8u(r));
00086         icl8u *pg = bufSrc.getData(1)+r*OFS2;
00087         for(int g=0;g<256;g++){
00088         std::fill(pg+g*OFS1,pg+(g+1)*OFS1, icl8u(g));
00089         icl8u *pb = bufSrc.getData(2)+r*OFS2 + g*OFS1;
00090         for(int b=0;b<256;b++){
00091         pb[b] = icl8u(b);
00092         }
00093         }
00094         }
00095         }
00096         icl8u *m_apucLUT[3];
00097         
00098         inline void convert3to3(const icl8u &s1,
00099         const icl8u &s2,const 
00100         icl8u &s3, icl8u s1, 
00101         icl8u &d1, icl8u &d2, icl8u &d3){
00102         int idx = s1+OFS1*s2+OFS3*s3;
00103         d1 = m_apucLUT[0][idx];
00104         d2 = m_apucLUT[1][idx];
00105         d3 = m_apucLUT[2][idx];
00106         }
00107         };
00108         */
00109   } // namespace core
00110 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines