⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cimg.h

📁 一个语言识别引擎
💻 H
📖 第 1 页 / 共 5 页
字号:
                                       _a##x<(int)((img).width)  || _n##x==--_a##x || x==(_a##x=--_n##x); \
                                       _b##x=_p##x,_p##x=x++,_n##x++,_a##x++)
#define cimg_5mapY(img,y)         for (int _b##y=0,_p##y=0,y=0,_n##y=1,_a##y=2; \
                                       _a##y<(int)((img).height) || _n##y==--_a##y || y==(_a##y=--_n##y); \
                                       _b##y=_p##y,_p##y=y++,_n##y++,_a##y++)
#define cimg_5mapZ(img,z)         for (int _b##z=0,_p##z=0,z=0,_n##z=1,_a##z=2; \
                                       _a##z<(int)((img).depth)  || _n##z==--_a##z || z==(_a##z=--_n##z); \
                                       _b##z=_p##z,_p##z=z++,_n##z++,_a##z++)
#define cimg_5mapXY(img,x,y)      cimg_5mapY(img,y) cimg_5mapX(img,x)
#define cimg_5mapXZ(img,x,z)      cimg_5mapZ(img,z) cimg_5mapX(img,x)
#define cimg_5mapYZ(img,y,z)      cimg_5mapZ(img,z) cimg_5mapY(img,y)
#define cimg_5mapXYZ(img,x,y,z)   cimg_5mapZ(img,z) cimg_5mapXY(img,x,y)

#define cimg_map2x2x1(img,x,y,z,v,I) cimg_2mapY(img,y) \
       for (int _n##x=1, x=(int)((I##cc=(img)(0,    y,z,v)), \
                                 (I##cn=(img)(0,_n##y,z,v)), \
				 0); \
            (_n##x<(int)((img).width) && ((I##nc=(img)(_n##x,    y,z,v)), \
                                          (I##nn=(img)(_n##x,_n##y,z,v)), \
                                          1)) || x==--_n##x; \
            I##cc=I##nc, I##cn=I##nn, \
            x++,_n##x++ )

#define cimg_map3x3x1(img,x,y,z,v,I) cimg_3mapY(img,y) \
       for (int _n##x=1, _p##x=(int)((I##cp=I##pp=(img)(0,_p##y,z,v)), \
                                     (I##cc=I##pc=(img)(0,  y,z,v)), \
                                     (I##cn=I##pn=(img)(0,_n##y,z,v))), \
                                     x=_p##x=0; \
            (_n##x<(int)((img).width) && ((I##np=(img)(_n##x,_p##y,z,v)), \
                                          (I##nc=(img)(_n##x,    y,z,v)), \
                                          (I##nn=(img)(_n##x,_n##y,z,v)), \
                                          1)) || x==--_n##x; \
              I##pp=I##cp, I##pc=I##cc, I##pn=I##cn, \
              I##cp=I##np, I##cc=I##nc, I##cn=I##nn, \
              _p##x=x++,_n##x++ )


#define cimg_map4x4x1(img,x,y,z,v,I) cimg_4mapY(img,y) \
       for (int _a##x=2, _n##x=1, x=(int)((I##cp=I##pp=(img)(0,_p##y,z,v)), \
                                          (I##cc=I##pc=(img)(0,    y,z,v)), \
                                          (I##cn=I##pn=(img)(0,_n##y,z,v)), \
                                          (I##ca=I##pa=(img)(0,_a##y,z,v)), \
                                          (I##np=(img)(_n##x,_p##y,z,v)), \
                                          (I##nc=(img)(_n##x,    y,z,v)), \
                                          (I##nn=(img)(_n##x,_n##y,z,v)), \
                                          (I##na=(img)(_n##x,_a##y,z,v)), \
 				          0), _p##x=0; \
            (_a##x<(int)((img).width) && ((I##ap=(img)(_a##x,_p##y,z,v)), \
                                          (I##ac=(img)(_a##x,    y,z,v)), \
                                          (I##an=(img)(_a##x,_n##y,z,v)), \
                                          (I##aa=(img)(_a##x,_a##y,z,v)), \
                                          1)) || _n##x==--_a##x || x==(_a##x=--_n##x); \
              I##pp=I##cp, I##pc=I##cc, I##pn=I##cn, I##pa=I##ca, \
              I##cp=I##np, I##cc=I##nc, I##cn=I##nn, I##ca=I##na, \
              I##np=I##ap, I##nc=I##ac, I##nn=I##an, I##na=I##aa, \
              _p##x=x++, _n##x++, _a##x++ )

#define cimg_map5x5x1(img,x,y,z,v,I) cimg_5mapY(img,y) \
       for (int _a##x=2, _n##x=1, _b##x=(int)((I##cb=I##pb=I##bb=(img)(0,_b##y,z,v)), \
                                              (I##cp=I##pp=I##bp=(img)(0,_p##y,z,v)), \
                                              (I##cc=I##pc=I##bc=(img)(0,    y,z,v)), \
                                              (I##cn=I##pn=I##bn=(img)(0,_n##y,z,v)), \
                                              (I##ca=I##pa=I##ba=(img)(0,_a##y,z,v)), \
                                              (I##nb=(img)(_n##x,_b##y,z,v)), \
                                              (I##np=(img)(_n##x,_p##y,z,v)), \
                                              (I##nc=(img)(_n##x,   y,z,v)), \
                                              (I##nn=(img)(_n##x,_n##y,z,v)), \
                                              (I##na=(img)(_n##x,_a##y,z,v))), \
                                              x=0, _p##x=_b##x=0; \
            (_a##x<(int)((img).width) && ((I##ab=(img)(_a##x,_b##y,z,v)), \
                                          (I##ap=(img)(_a##x,_p##y,z,v)), \
                                          (I##ac=(img)(_a##x,    y,z,v)), \
                                          (I##an=(img)(_a##x,_n##y,z,v)), \
                                          (I##aa=(img)(_a##x,_a##y,z,v)), \
                                          1)) || _n##x==--_a##x || x==(_a##x=--_n##x); \
              I##bb=I##pb, I##bp=I##pp, I##bc=I##pc, I##bn=I##pn, I##ba=I##pa, \
              I##pb=I##cb, I##pp=I##cp, I##pc=I##cc, I##pn=I##cn, I##pa=I##ca, \
              I##cb=I##nb, I##cp=I##np, I##cc=I##nc, I##cn=I##nn, I##ca=I##na, \
              I##nb=I##ab, I##np=I##ap, I##nc=I##ac, I##nn=I##an, I##na=I##aa, \
              _b##x=_p##x, _p##x=x++, _n##x++, _a##x++ )

#define cimg_map2x2x2(img,x,y,z,v,I) cimg_2mapYZ(img,y,z) \
       for (int _n##x=1, x=(int)((I##ccc=(img)(0,    y,    z,v)), \
                                 (I##cnc=(img)(0,_n##y,    z,v)), \
                                 (I##ccn=(img)(0,    y,_n##z,v)), \
                                 (I##cnn=(img)(0,_n##y,_n##z,v)), \
                                 0); \
            (_n##x<(int)((img).width) && ((I##ncc=(img)(_n##x,    y,    z,v)), \
                                          (I##nnc=(img)(_n##x,_n##y,    z,v)), \
                                          (I##ncn=(img)(_n##x,    y,_n##z,v)), \
                                          (I##nnn=(img)(_n##x,_n##y,_n##z,v)), \
                                          1)) || x==--_n##x; \
              I##ccc=I##ncc, I##cnc=I##nnc, \
              I##ccn=I##ncn, I##cnn=I##nnn, \
              x++, _n##x++ )

#define cimg_map3x3x3(img,x,y,z,v,I) cimg_3mapYZ(img,y,z) \
       for (int _n##x=1, _p##x=(int)((I##cpp=I##ppp=(img)(0,_p##y,_p##z,v)), \
                                     (I##ccp=I##pcp=(img)(0,    y,_p##z,v)), \
                                     (I##cnp=I##pnp=(img)(0,_n##y,_p##z,v)), \
                                     (I##cpc=I##ppc=(img)(0,_p##y,    z,v)), \
                                     (I##ccc=I##pcc=(img)(0,    y,    z,v)), \
                                     (I##cnc=I##pnc=(img)(0,_n##y,    z,v)), \
                                     (I##cpn=I##ppn=(img)(0,_p##y,_n##z,v)), \
                                     (I##ccn=I##pcn=(img)(0,    y,_n##z,v)), \
                                     (I##cnn=I##pnn=(img)(0,_n##y,_n##z,v))),\
                                     x=_p##x=0; \
            (_n##x<(int)((img).width) && ((I##npp=(img)(_n##x,_p##y,_p##z,v)), \
                                          (I##ncp=(img)(_n##x,    y,_p##z,v)), \
                                          (I##nnp=(img)(_n##x,_n##y,_p##z,v)), \
                                          (I##npc=(img)(_n##x,_p##y,    z,v)), \
                                          (I##ncc=(img)(_n##x,    y,    z,v)), \
                                          (I##nnc=(img)(_n##x,_n##y,    z,v)), \
                                          (I##npn=(img)(_n##x,_p##y,_n##z,v)), \
                                          (I##ncn=(img)(_n##x,    y,_n##z,v)), \
                                          (I##nnn=(img)(_n##x,_n##y,_n##z,v)), \
                                          1)) || x==--_n##x; \
              I##ppp=I##cpp, I##pcp=I##ccp, I##pnp=I##cnp, \
              I##cpp=I##npp, I##ccp=I##ncp, I##cnp=I##nnp, \
              I##ppc=I##cpc, I##pcc=I##ccc, I##pnc=I##cnc, \
              I##cpc=I##npc, I##ccc=I##ncc, I##cnc=I##nnc, \
              I##ppn=I##cpn, I##pcn=I##ccn, I##pnn=I##cnn, \
              I##cpn=I##npn, I##ccn=I##ncn, I##cnn=I##nnn, \
              _p##x=x++, _n##x++ )

/*
 #------------------------------------------------
 #
 #
 #  Definition of the cimg_library:: namespace
 #
 #
 #------------------------------------------------
 */

//! Namespace that encompasses all classes and functions of the %CImg library.
/**
   This namespace is defined to avoid class names collisions that could happen
   with the include of other C++ header files. Anyway, it should not happen
   very often and you may start most of your programs with
   \code
   #include "CImg.h"
   using namespace cimg_library;
   \endcode
   to simplify the declaration of %CImg Library objects variables afterward.
**/

namespace cimg_library {

  // Define the CImg classes.
  template<typename T=float> struct CImg;
  template<typename T=float> struct CImgl;
  struct CImgStats;
  struct CImgDisplay;
  struct CImgException; 

  namespace cimg {

    // The bodies of the functions below are defined at the end of the file
    inline int dialog(const char *title,const char *msg,const char *button1_txt="OK",
		      const char *button2_txt=NULL,const char *button3_txt=NULL,
		      const char *button4_txt=NULL,const char *button5_txt=NULL,
		      const char *button6_txt=NULL,const bool centering = false);

    template<typename tfunc, typename tp, typename tf>
    inline void marching_cubes(const tfunc& func, const float isovalue,
			       const float x0,const float y0,const float z0,
			       const float x1,const float y1,const float z1,
			       const float resx,const float resy,const float resz,
			       CImgl<tp>& points, CImgl<tf>& primitives,
			       const bool invert_faces = false);

    template<typename tfunc, typename tp, typename tf>
    inline void marching_squares(const tfunc& func, const float isovalue,
				 const float x0,const float y0,
				 const float x1,const float y1,
				 const float resx,const float resy,
				 CImgl<tp>& points, CImgl<tf>& primitives);
  }
  
  /*
   #----------------------------------------------
   #
   #
   # Definition of the CImgException structures
   #
   #
   #----------------------------------------------
   */

  // Never use the following macro in your own code !
#define cimg_exception_err(etype,disp_flag) \
  if (cimg_debug>=1) { \
    std::va_list ap; \
    va_start(ap,format); \
    std::vsprintf(message,format,ap); \
    va_end(ap); \
    if (disp_flag) { \
      try { cimg::dialog(etype,message,"Abort"); } \
      catch (CImgException&) { std::fprintf(stderr,"# %s :\n%s\n\n",etype,message); } \
    } else std::fprintf(stderr,"# %s :\n%s\n\n",etype,message); \
  }
    
  //! Class which is thrown when an error occured during a %CImg library function call.
  /** 
      
      \section ex1 Overview
  
      CImgException is the base class of %CImg exceptions.
      Exceptions are thrown by the %CImg Library when an error occured in a %CImg library function call.
      CImgException is seldom thrown itself. Children classes that specify the kind of error encountered
      are generally used instead. These sub-classes are :

      - \b CImgInstanceException : Thrown when the instance associated to the called %CImg function is not

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -