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

📄 matlib.h

📁 用C++实现的数字图像处理各个算法源代码 我精心整理的 很难的啊 希望可以给大家带来帮助
💻 H
📖 第 1 页 / 共 5 页
字号:

#ifndef matlibH
#define matlibH

/*
 *    MATLIB header file
 *
 *    Copyright (c) MathTools Ltd. 1994-1999. All rights reserved.
 */

#define MATCOM_VERSION 4501
#define MATCOM_BUILD   1027

#if defined(__WINDOWS_386__) || defined(WIN32) || defined(_WIN32) || defined(__NT__)||defined(_MSC_VER)
#ifndef __WIN32__
#define __WIN32__ 1
#endif
#endif

#if !defined(_Windows) && (defined(_WINDOWS) || defined(__WIN32__))
#define _Windows 1
#endif

#if !defined(BIT16) && (defined(__BORLANDC__) && !defined(__WIN32__))
#define BIT16 1
#define HELPER
#else
#define HELPER template
#endif

#if !defined(__OS2__) && defined(__TOS_OS2__)
#define __OS2__ 1
#endif

#if defined (_MSC_VER) || defined(__MINGW32__)
  #if defined (MLIBDLL)
    #define DLLI __declspec(dllexport)
  #else
    #define DLLI __declspec(dllimport)
  #endif
  #define DLLX __declspec(dllexport)
  #define DLLW
#elif defined (__BORLANDC__) && defined(__WIN32__)
  #if defined (MLIBDLL)
    #define DLLI __export
  #else
    #define DLLI __import
  #endif
  #define DLLX __export
  #define DLLW
#elif defined (__WATCOMC__) && defined(__WIN32__)
  #if defined (MLIBDLL)
    #define DLLI __export
    #define DLLW
  #else
    #define DLLI
    #define DLLW __declspec(dllimport)
  #endif
  #define DLLX __export
#else
  #define DLLI
  #define DLLX
  #define DLLW
#endif

#ifdef _MSC_VER
  #define PPDLLI DLLI **
  #define PDLLI  DLLI *
  #define RDLLI  DLLI &
  #define PDLLX  DLLX *
  #define RDLLX  DLLX &
#else
  #define PPDLLI ** DLLI
  #define PDLLI  *  DLLI
  #define RDLLI  &  DLLI
  #define PDLLX  *  DLLX
  #define RDLLX  &  DLLX
#endif


#ifdef __BORLANDC__
#define __MFC_COMPAT__
#if __BORLANDC__<=0x520
#define __MINMAX_DEFINED
#define _WINNETWK_
#endif
#endif

#ifdef _MSC_VER
#if _MSC_VER<1100
#define NO_BUILT_IN_SUPPORT_FOR_BOOL
#endif
#endif

#ifdef __WATCOMC__
#if __WATCOMC__<1100
#define NO_BUILT_IN_SUPPORT_FOR_BOOL
#endif
#pragma warning 379 9
#endif

typedef unsigned char		uint8;
typedef float			single;

#define max_ndims 4
#define mt_stack_max_depth 513
#define m_type double

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#undef TMP_MAX
#undef abs
#undef acos
#undef and
#undef asin
#undef atan
#undef atan2
#undef bitand
#undef bitor
#undef clear
#undef cos
#undef exp
#undef fabs
#undef feof
#undef ferror
#undef finite
#undef isinf
#undef islower
#undef isnan
#undef isspace
#undef isupper
#undef log
#undef log10
#undef log2
#undef max
#undef min
#undef not
#undef or
#undef sin
#undef sin
#undef sqrt
#undef strcmp
#undef strcmpi
#undef strncmp
#undef strncmpi
#undef tan
#undef xor


#ifndef mH
#define mH

enum op_t {
  OP_DIFF,
  OP_DEL2,
  OP_GRADIENT,
  OP_ALL,
  OP_ANY,
  OP_CUMPROD,
  OP_CUMSUM,
  OP_MAX_1,
  OP_MEDIAN,
  OP_MIN_1,
  OP_PROD,
  OP_SUM,
  OP_UNWRAP,
  OP_ABS,
  OP_ACOS,
  OP_ACOSH,
  OP_ACOT,
  OP_ACOTH,
  OP_ACSC,
  OP_ACSCH,
  OP_AND,
  OP_ANGLE,
  OP_ASEC,
  OP_ASECH,
  OP_ASIN,
  OP_ASINH,
  OP_ATAN,
  OP_ATAN2,
  OP_ATANH,
  OP_BETA,
  OP_BETALN,
  OP_BITAND,
  OP_BITCMP,
  OP_BITGET,
  OP_BITOR,
  OP_BITRESET,
  OP_BITSET,
  OP_BITSHIFT,
  OP_BITXOR,
  OP_CEIL,
  OP_CONJ,
  OP_COS,
  OP_COSH,
  OP_COT,
  OP_COTH,
  OP_CSC,
  OP_CSCH,
  OP_EQ,
  OP_ERFC,
  OP_ERFCX,
  OP_ERFINV,
  OP_ERF,
  OP_EXP,
  OP_EXPINT,
  OP_FIX,
  OP_FLOOR,
  OP_GAMMA,
  OP_GAMMAINC,
  OP_GAMMALN,
  OP_GE,
  OP_GT,
  OP_IMAG,
  OP_ISFINITE,
  OP_ISINF,
  OP_ISNAN,
  OP_LDIVIDE,
  OP_LE,
  OP_LOG,
  OP_LOG10,
  OP_LOG2,
  OP_LT,
  OP_MAX_2,
  OP_MINUS,
  OP_MIN_2,
  OP_MOD,
  OP_MTIMES,
  OP_NE,
  OP_NOT,
  OP_OR,
  OP_PLUS,
  OP_POW2_1,
  OP_POW2_2,
  OP_POWER,
  OP_RDIVIDE,
  OP_REM,
  OP_ROUND,
  OP_SEC,
  OP_SECH,
  OP_SIGN,
  OP_SIN,
  OP_SINC,
  OP_SINH,
  OP_SQRT,
  OP_TAN,
  OP_TANH,
  OP_TIMES,
  OP_UMINUS,
  OP_UPLUS,
  OP_XOR
};

#undef TMP_MAX
#undef abs
#undef acos
#undef and
#undef asin
#undef atan
#undef atan2
#undef bitand
#undef bitor
#undef clear
#undef cos
#undef exp
#undef fabs
#undef feof
#undef ferror
#undef finite
#undef isinf
#undef islower
#undef isnan
#undef isspace
#undef isupper
#undef log
#undef log10
#undef log2
#undef max
#undef min
#undef not
#undef or
#undef sin
#undef sin
#undef sqrt
#undef strcmp
#undef strcmpi
#undef strncmp
#undef strncmpi
#undef tan
#undef xor


class Mm;
typedef const Mm& cMm;
class Mr;
typedef const Mr& cMr;

#define dMm(x) Mm x(i_o,#x,0)

#define M_VECTOR(x,v) x=zeros(1,int(sizeof(v)/sizeof(v[0]))); \
		    copy_data(x.addr(),v,int(sizeof(v)/sizeof(v[0])));

#define mswitch(x)	switchdepth++; switchvar.br(switchdepth)=switchinit(x); do
#define beginmswitch	if (switchfalse)
#define mcase(x)	else if (isequal(x,switchvar.br(switchdepth)))
#define otherwise	else
#define endmswitch	while (0);switchdepth--

struct i_o_t {
  int i;
  int o;
};

#define Mcinitsz 16

class Mc {
  friend class Mm;

  const Mm* initd[Mcinitsz];
  int initdyn[Mcinitsz];
  const Mm** d;
  int* dyn;
  int siz;
  int last;
  int cl;
  void DLLI operator =(const Mc&);
public:
  DLLI Mc();
  DLLI Mc(const Mc& x);
  DLLI Mc(int new_cl, int new_dyn, cMm x);
  DLLI ~Mc();
  const Mm* br(int idx) const { return d[idx-1]; }
  int size() const { return last+1; }
  Mc RDLLI operator ,(cMm x);
  Mc RDLLI operator ,(const char* x);
  Mc RDLLI operator ,(double x);
};

enum Mr_idx {
  Mr_idxx=-1, Mr_idx0=0, Mr_idx1=1, Mr_idx2=2, Mr_idx3=3, Mr_idx4=4
};

enum Mr_idx_type {
  Mr_idx_paren='(', Mr_idx_br='{', Mr_idx_struct='.', Mr_idx_error='?'
};

class Mr {
public:
  friend class Mm;
  Mr_idx       indexed;
  Mr_idx_type  how;
  const char*  field;
  int          isr;
  Mm*          data;
  Mr*          datar;
  int          idx_free[max_ndims];
  Mm*          idx[max_ndims];

  DLLI Mr();
  DLLI Mr(cMm src);
  DLLI Mr(cMr src);
  DLLI Mr(cMm src, const char* f);
  DLLI Mr(cMr src, const char* f);
  DLLI Mr(Mr_idx_type new_how, cMm src, cMm i0);
  DLLI Mr(Mr_idx_type new_how, cMm src, cMm i0, cMm i1);
  DLLI Mr(Mr_idx_type new_how, cMm src, cMm i0, cMm i1, cMm i2);
  DLLI Mr(Mr_idx_type new_how, cMm src, cMm i0, cMm i1, cMm i2, cMm i3);
  DLLI Mr(Mr_idx_type new_how, cMr src, cMm i0);
  DLLI Mr(Mr_idx_type new_how, cMr src, cMm i0, cMm i1);
  DLLI Mr(Mr_idx_type new_how, cMr src, cMm i0, cMm i1, cMm i2);
  DLLI Mr(Mr_idx_type new_how, cMr src, cMm i0, cMm i1, cMm i2, cMm i3);
  DLLI ~Mr();
  int DLLI size() const;
  Mr DLLI member(const char* field_name) const { return Mr(*this, field_name); }
  Mr DLLI operator ()(cMm i0) const { return Mr(Mr_idx_paren, *this, i0); }
  Mr DLLI operator ()(cMm i0, cMm i1) const { return Mr(Mr_idx_paren, *this, i0, i1); }
  Mr DLLI operator ()(cMm i0, cMm i1, cMm i2) const { return Mr(Mr_idx_paren, *this, i0, i1, i2); }
  Mr DLLI operator ()(cMm i0, cMm i1, cMm i2, cMm i3) const { return Mr(Mr_idx_paren, *this, i0, i1, i2, i3); }

  Mr DLLI br(cMm i0) const { return Mr(Mr_idx_br,*this, i0); }
  Mr DLLI br(cMm i0, cMm i1) const { return Mr(Mr_idx_br,*this, i0, i1); }
  Mr DLLI br(cMm i0, cMm i1, cMm i2) const { return Mr(Mr_idx_br,*this, i0, i1, i2); }
  Mr DLLI br(cMm i0, cMm i1, cMm i2, cMm i3) const { return Mr(Mr_idx_br,*this, i0, i1, i2, i3); }

  void DLLI operator =(cMm src);
  void DLLI operator =(cMr src);
  int find_index_sizes(int sub_index_sizes[max_ndims]) const;
  int advance_linear_index(int sub_index_sizes[max_ndims], int sub_index[max_ndims], int sub_indexed[max_ndims],int find_limits, int index_limits[max_ndims], int err) const;
}; // Mr

/* TODO
template <class T>class Sr {
  friend class M<T>;

  int indexed;
  M<T>& data;
  int idx[max_ndims];
public:
  DLLI Sr();
  DLLI Sr(const Sr<T>& src);
  DLLI Sr(const M<T>& src);
  DLLI Sr(const M<T>& src, m_type i0);
  DLLI Sr(const M<T>& src, m_type i0, m_type i1);
  DLLI Sr(const M<T>& src, m_type i0, m_type i1, m_type i2);
  DLLI Sr(const M<T>& src, m_type i0, m_type i1, m_type i2, m_type i3);
  DLLI ~Sr();
  void DLLI operator =(const M<T>& src);
  void DLLI operator =(const Sr<T>& src);
}; // Sr
*/

enum mt_matrix_types {
  mt_uninit_matrix=0, mt_double_matrix, mt_uint8_matrix, mt_matrix_matrix

⌨️ 快捷键说明

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