资源简介

本人根据模式识别教材写的朴素贝叶斯分类器,用于人脸识别,人脸参数化方式为,把人脸分为9个区域,计算9个区域的黑白对比度,希望能抛砖引玉,人脸库请自己下载

资源截图

代码片段和文件信息

// bmp_display.cpp : 定义应用程序的入口点。
#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


评论

共有 条评论