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

📄 dibimage.h

📁 人耳识别技术是20世纪90年代末开始兴起的一种生物特征识别技术
💻 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 + -