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)
函數(shù)
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);
//
圖像點運算函數(shù)
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);
// 圖像幾何變換函數(shù)
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);
// 圖像正交變換函數(shù)
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);
// 圖像模板變換函數(shù)
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);
//
圖像形態(tài)學變換函數(shù)
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);
//
圖像邊緣與輪廓運算函數(shù)
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類/實現(xiàn)