資源簡介
本人根據(jù)模式識別教材寫的樸素貝葉斯分類器,用于人臉識別,人臉參數(shù)化方式為,把人臉分為9個區(qū)域,計算9個區(qū)域的黑白對比度,希望能拋磚引玉,人臉庫請自己下載

代碼片段和文件信息
//?bmp_display.cpp?:?定義應(yīng)用程序的入口點(diǎn)。
#include?“stdafx.h“
#include?“bmp_display.h“
#include?
#include?
#include?
#include?
#define?MAX_LOADSTRING?100
#define?TIMER_SEC??????1
HINSTANCE?hInst;
TCHAR?sztitle[MAX_LOADSTRING];
TCHAR?szWindowClass[MAX_LOADSTRING];
ATOM MyRegisterClass(HINSTANCE?hInstance);
BOOL InitInstance(HINSTANCE?int);
LRESULT?CALLBACK WndProc(HWND?UINT?WPARAM?LPARAM);
INT_PTR?CALLBACK About(HWND?UINT?WPARAM?LPARAM);
int?APIENTRY?_tWinMain(HINSTANCE?hInstance
???HINSTANCE?hPrevInstance
???LPTSTR????lpCmdLine
???int???????nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
MSG?msg;
HACCEL?hAccelTable;
????get_distribution_param(“./MITEX/faces/““./MITEX/nonfaces/“);
LoadString(hInstance?IDS_APP_title?sztitle?MAX_LOADSTRING);
LoadString(hInstance?IDC_BMP_DISPLAY?szWindowClass?MAX_LOADSTRING);
MyRegisterClass(hInstance);
?
if?(!InitInstance?(hInstance?nCmdShow))
{
return?FALSE;
}
hAccelTable?=?LoadAccelerators(hInstance?MAKEINTRESOURCE(IDC_BMP_DISPLAY));
while?(GetMessage(&msg?NULL?0?0))
{
if?(!TranslateAccelerator(msg.hwnd?hAccelTable?&msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return?(int)?msg.wParam;
}
ATOM?MyRegisterClass(HINSTANCE?hInstance)
{
WNDCLASSEX?wcex;
wcex.cbSize?=?sizeof(WNDCLASSEX);
wcex.style =?CS_HREDRAW?|?CS_VREDRAW;
wcex.lpfnWndProc =?WndProc;
wcex.cbClsExtra =?0;
wcex.cbWndExtra =?0;
wcex.hInstance =?hInstance;
wcex.hIcon =?LoadIcon(hInstance?MAKEINTRESOURCE(IDI_BMP_DISPLAY));
wcex.hCursor =?LoadCursor(NULL?IDC_ARROW);
wcex.hbrBackground =?(HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName =?MAKEINTRESOURCE(IDC_BMP_DISPLAY);
wcex.lpszClassName =?szWindowClass;
wcex.hIconSm =?LoadIcon(wcex.hInstance?MAKEINTRESOURCE(IDI_SMALL));
return?RegisterClassEx(&wcex);
}
BOOL?InitInstance(HINSTANCE?hInstance?int?nCmdShow)
{
HWND?hWnd;
hInst?=?hInstance;
hWnd?=?CreateWindow(szWindowClass?sztitle?WS_OVERLAPPEDWINDOW
CW_USEDEFAULT?0?CW_USEDEFAULT?0?NULL?NULL?hInstance?NULL);
if?(!hWnd)
{
return?FALSE;
}
ShowWindow(hWnd?nCmdShow);
UpdateWindow(hWnd);
return?TRUE;
}
LRESULT?CALLBACK?WndProc(HWND?hWnd?UINT?message?WPARAM?wParam?LPARAM?lParam)
{
PAINTSTRUCT?ps;
HDC?hdc;
static?long?dir_hand?=?0;
static?struct?_finddata_t?c_file;
static?FILE?*?stream;
static?float?features[20];
static?unsigned?char?image_buf[1200];
static?unsigned?char?image_buf2[1200];
static?unsigned?char?tmp_buf[400];
static?unsigned?char?info_buf[1478];
static?BITMAPINFO?image_head;
static?unsigned?int?stop;
static?char?file_dir[50];
static?char?info_text[100];
static?int?is_face;
int?iindex;
switch?(message)
{
case?WM_CREATE:
dir_hand?=?_findfirst(“./MITEX/faces/*.bmp“&c_file);
if(dir_hand
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????20190??2009-11-30?09:40??bmp_display.cpp
?????文件????????548??2009-11-27?14:00??bmp_display.h
-----------?---------??----------?-----??----
????????????????20738????????????????????2
- 上一篇:3DGIS開發(fā)平臺比較
- 下一篇:PE病毒的學(xué)習(xí)資料包
評論
共有 條評論