?? dibimage.h
字號:
// DibImage.h: interface for the CDibImage class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DIBIMAGE_H__254F3D1E_BB20_40DA_AE07_E8E0219DFA8C__INCLUDED_)
#define AFX_DIBIMAGE_H__254F3D1E_BB20_40DA_AE07_E8E0219DFA8C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
DECLARE_HANDLE(HDIB); // DIB句柄
#define PALVERSION 0x300 // DIB常量
/* DIB宏 */
// 判斷是否是Win 3.0的DIB
#define IS_WIN30_DIB(lpbi) ((*(LPDWORD)(lpbi)) == sizeof(BITMAPINFOHEADER))
// 計算矩形區域的寬度
#define RECTWIDTH(lpRect) ((lpRect)->right - (lpRect)->left)
// 計算矩形區域的高度
#define RECTHEIGHT(lpRect) ((lpRect)->bottom - (lpRect)->top)
// 在計算圖像大小時,采用公式:biSizeImage = biWidth' × biHeight。
// 是biWidth',而不是biWidth,這里的biWidth'必須是4的整倍數,表示
// 大于或等于biWidth的,離4最近的整倍數。WIDTHBYTES就是用來計算
// biWidth'
#define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)
// Dib文件頭標志(字符串"BM",寫DIB時用到該常數)
#define DIB_HEADER_MARKER ((WORD) ('M' << 8) | 'B')
// 圖像邊緣與輪廓運算函數///////////////////////////////////
typedef struct{
int Value;
int Dist;
int AngleNumber;
} MaxValue;
typedef struct{
int Height;
int Width;
} Seed;
typedef struct{
int Height;
int Width;
} Point;
/////////////////////////////////////////////////////////////
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 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 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 SobelDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); // 8方向
BOOL KirschDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); // 8方向
BOOL ContourDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight); // 邊緣提取
};
#endif // !defined(AFX_DIBIMAGE_H__254F3D1E_BB20_40DA_AE07_E8E0219DFA8C__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -