zz:http://www.cnblogs.com/skyseraph/archive/2011/04/22/2024657.html
Dib头文件
class CDibImage
{
// Constructor and Destructor
///////////////////////////////
public:
CDibImage();
virtual ~CDibImage();
// function
/////////////////////////////////////////////////
public:
// DIB(Independent Bitmap)
函数
BOOL
PaintDIB (HDC, LPRECT, HDIB, LPRECT, CPalette* pPal);
BOOL
CreateDIBPalette(HDIB hDIB, CPalette* cPal);
LPSTR
FindDIBBits (LPSTR lpbi);
DWORD
DIBWidth (LPSTR lpDIB);
DWORD
DIBHeight (LPSTR lpDIB);
WORD
PaletteSize (LPSTR lpbi);
WORD
DIBNumColors (LPSTR lpbi);
HGLOBAL CopyHandle (HGLOBAL h);
BOOL
SaveDIB (HDIB hDib, CFile& file);
HDIB
ReadDIBFile(CFile& file);
//
图像点运算函数
BOOL LinerTrans(LPSTR lpDIBBits,
LONG lWidth, LONG lHeight, FLOAT fA, FLOAT
fB);
BOOL ThresholdTrans(LPSTR
lpDIBBits, LONG lWidth, LONG lHeight, BYTE bThre);
BOOL WindowTrans(LPSTR
lpDIBBits, LONG lWidth, LONG lHeight, BYTE
bLow, BYTE bUp);
BOOL GrayStretch(LPSTR
lpDIBBits, LONG lWidth, LONG lHeight, BYTE
bX1, BYTE bY1, BYTE bX2, BYTE bY2);
BOOL InteEqualize(LPSTR
lpDIBBits, LONG lWidth, LONG lHeight);
// 图像几何变换函数
BOOL TranslationDIB1 (LPSTR
lpDIBBits, LONG lWidth, LONG lHeight, LONG
lXOffset, LONG lYOffset);
BOOL TranslationDIB (LPSTR
lpDIBBits, LONG lWidth, LONG lHeight, LONG
lXOffset, LONG lYOffset);
BOOL MirrorDIB(LPSTR lpDIBBits,
LONG lWidth, LONG lHeight, BOOL bDirection);
BOOL TransposeDIB(LPSTR
lpbi);
HGLOBAL ZoomDIB(LPSTR lpbi, float fXZoomRatio,
float fYZoomRatio);
HGLOBAL RotateDIB(LPSTR lpbi, int
iRotateAngle);
HGLOBAL RotateDIB2(LPSTR lpbi, int
iRotateAngle);
unsigned char Interpolation (LPSTR lpDIBBits,
LONG lWidth, LONG lHeight, FLOAT x, FLOAT y);
// 图像正交变换函数
VOID
FFT(complex<double> * TD,
complex<double> * FD, int r);
VOID
IFFT(complex<double> * FD,
complex<double> * TD, int r);
VOID DCT(double *f, double *F, int power);
VOID IDCT(double *F, double *f, int power);
VOID WALSH(double *f, double *F, int r);
VOID IWALSH(double *F, double *f, int r);
BOOL Fourier(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight);
BOOL DIBDct(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight);
BOOL DIBWalsh(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight);
BOOL DIBWalsh1(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight);
// 图像模板变换函数
BOOL Template(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight, int
iTempH, int iTempW, int iTempMX,
int iTempMY, FLOAT * fpArray, FLOAT fCoef);
BOOL MedianFilter(LPSTR lpDIBBits, LONG lWidth,
LONG lHeight, int iFilterH, int
iFilterW, int
iFilterMX, int iFilterMY);
unsigned char GetMedianNum(unsigned char *
bArray, int iFilterLen);
BOOL GradSharp(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight, BYTE bThre);
BOOL ReplaceColorPal(LPSTR lpDIB, BYTE *
bpColorsTable);
//
图像形态学变换函数
BOOL ErosionDIB (LPSTR lpDIBBits, LONG lWidth,
LONG lHeight, BOOL bHori
, int
structure[3][3]);
BOOL DilationDIB (LPSTR lpDIBBits, LONG lWidth,
LONG lHeight, BOOL bHori
, int
structure[3][3]);
BOOL OpenDIB (LPSTR lpDIBBits, LONG lWidth, LONG
lHeight, BOOL bHori
, int
structure[3][3]);
BOOL CloseDIB (LPSTR lpDIBBits, LONG lWidth, LONG
lHeight, BOOL bHori
, int
structure[3][3]);
BOOL ThiningDIB (LPSTR lpDIBBits, LONG lWidth,
LONG lHeight);
//
图像边缘与轮廓运算函数
BOOL RobertDIB(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight);
BOOL SobelDIB(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight);
BOOL PrewittDIB(LPSTR lpDIBBits, LONG lWidth,
LONG lHeight);
BOOL KirschDIB(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight);
BOOL GaussDIB(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight);
BOOL HoughDIB(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight);
BOOL FillDIB(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight);
BOOL Fill2DIB(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight);
BOOL ContourDIB(LPSTR lpDIBBits, LONG lWidth,
LONG lHeight);
BOOL TraceDIB(LPSTR lpDIBBits, LONG lWidth, LONG
lHeight);
};
Dib类/实现