資源簡(jiǎn)介
Hough變換、傅立葉變換、二值化、邊緣檢測(cè)、輪廓提取、模板匹配、閾值分割、圖像復(fù)原

代碼片段和文件信息
//?cdib.cpp
//?new?version?for?WIN32
#include?“stdafx.h“
#include?“cdib.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
IMPLEMENT_SERIAL(CDib?Cobject?0);
CDib::CDib()
{
m_hFile?=?NULL;
m_hBitmap?=?NULL;
m_hPalette?=?NULL;
m_nBmihAlloc?=?m_nImageAlloc?=?noAlloc;
Empty();
}
CDib::CDib(CSize?size?int?nBitCount)
{
m_hFile?=?NULL;
m_hBitmap?=?NULL;
m_hPalette?=?NULL;
m_nBmihAlloc?=?m_nImageAlloc?=?noAlloc;
Empty();
ComputePaletteSize(nBitCount);
m_lpBMIH?=?(LPBITMAPINFOHEADER)?new?
char[sizeof(BITMAPINFOHEADER)?+?sizeof(RGBQUAD)?*?m_nColorTableEntries];
m_nBmihAlloc?=?crtAlloc;
m_lpBMIH->biSize?=?sizeof(BITMAPINFOHEADER);
m_lpBMIH->biWidth?=?size.cx;
m_lpBMIH->biHeight?=?size.cy;
m_lpBMIH->biPlanes?=?1;
m_lpBMIH->biBitCount?=?nBitCount;
m_lpBMIH->biCompression?=?BI_RGB;
m_lpBMIH->biSizeImage?=?0;
m_lpBMIH->biXPelsPerMeter?=?0;
m_lpBMIH->biYPelsPerMeter?=?0;
m_lpBMIH->biClrUsed?=?m_nColorTableEntries;
m_lpBMIH->biClrImportant?=?m_nColorTableEntries;
ComputeMetrics();
memset(m_lpvColorTable?0?sizeof(RGBQUAD)?*?m_nColorTableEntries);
m_lpImage?=?NULL;??//?no?data?yet
}
CDib::~CDib()
{
Empty();
}
CSize?CDib::GetDimensions()
{
if(m_lpBMIH?==?NULL)?return?CSize(0?0);
return?CSize((int)?m_lpBMIH->biWidth?(int)?m_lpBMIH->biHeight);
}
BOOL?CDib::AttachMapFile(const?char*?strPathname?BOOL?bShare)?//?for?reading
{
//?if?we?open?the?same?file?twice?Windows?treats?it?as?2?separate?files
//?doesn‘t?work?with?rare?BMP?files?where?#?palette?entries?>?biClrUsed
HANDLE?hFile?=?::CreateFile(strPathname?GENERIC_WRITE?|?GENERIC_READ
bShare???FILE_SHARE_READ?:?0
NULL?OPEN_EXISTING?FILE_ATTRIBUTE_NORMAL?NULL);
ASSERT(hFile?!=?INVALID_HANDLE_VALUE);
DWORD?dwFileSize?=?::GetFileSize(hFile?NULL);
HANDLE?hMap?=?::CreateFileMapping(hFile?NULL?PAGE_READWRITE?0?0?NULL);
DWORD?dwErr?=?::GetLastError();
if(hMap?==?NULL)
{
AfxMessageBox(“Empty?bitmap?file“);
return?FALSE;
}
LPVOID?lpvFile?=?::MapViewOfFile(hMap?FILE_MAP_WRITE?0?0?0);?//?map?whole?file
ASSERT(lpvFile?!=?NULL);
if(((LPBITMAPFILEHEADER)?lpvFile)->bfType?!=?0x4d42)
{
AfxMessageBox(“Invalid?bitmap?file“);
DetachMapFile();
return?FALSE;
}
AttachMemory((LPBYTE)?lpvFile?+?sizeof(BITMAPFILEHEADER));
m_lpvFile?=?lpvFile;
m_hFile?=?hFile;
m_hMap?=?hMap;
return?TRUE;
}
BOOL?CDib::CopyToMapFile(const?char*?strPathname)
{
//?copies?DIB?to?a?new?file?releases?prior?pointers
//?if?you?previously?used?CreateSection?the?HBITMAP?will?be?NULL?(and?unusable)
BITMAPFILEHEADER?bmfh;
bmfh.bfType?=?0x4d42;??//?‘BM‘
bmfh.bfSize?=?m_dwSizeImage?+?sizeof(BITMAPINFOHEADER)?+
sizeof(RGBQUAD)?*?m_nColorTableEntries?+?sizeof(BITMAPFILEHEADER);
//?meaning?of?bfSize?open?to?interpretation
bmfh.bfReserved1?=?bmfh.bfReserved2?=?0;
bmfh.bfOffBits?=?sizeof(BITMAPFILEHEADER)?+?sizeof
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件??????66616??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\Couple.bmp
?????文件?????172800??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\DRAGON_256_1.bmp
?????文件??????42240??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\dragon1.bmp
?????文件?????262710??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\heci1.bmp
?????文件??????66616??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\rec1.bmp
?????文件??????66616??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\rec2.bmp
?????文件?????205306??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\test.bmp
?????文件?????308278??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\view.bmp
?????文件?????110414??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\Hough變換\result.bmp
?????文件?????110416??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\Hough變換\source.bmp
????..A.SH.??????5632??2005-06-17?11:42??VC++數(shù)字圖象處理\圖像\Hough變換\Thumbs.db
?????目錄??????????0??2006-05-26?09:30??VC++數(shù)字圖象處理\圖像\Hough變換
?????文件??????33120??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\bacteria.BMP
?????文件??????33118??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\bacteriagausslaplace.BMP
?????文件??????33118??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\bacteriaprewitt.BMP
?????文件??????33118??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\bacteriarobert.BMP
?????文件??????73160??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\blood1.BMP
?????文件??????73158??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\blood1gausslaplace.BMP
?????文件??????73158??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\blood1kirsch.BMP
?????文件??????73158??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\blood1robert.BMP
?????文件??????66616??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\Miss.bmp
?????文件??????66614??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\Missprewitt.bmp
?????文件??????66614??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\Missrobert.bmp
?????文件??????66614??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\Misssobel.bmp
????..A.SH.??????8192??2005-06-17?11:42??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)\Thumbs.db
?????目錄??????????0??2006-05-26?09:30??VC++數(shù)字圖象處理\圖像\邊緣檢測(cè)
?????文件??????66614??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\差影法\result.bmp
?????文件??????66614??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\差影法\source.bmp
?????文件??????66616??2003-06-18?22:44??VC++數(shù)字圖象處理\圖像\差影法\template.bmp
????..A.SH.??????7680??2005-06-17?11:42??VC++數(shù)字圖象處理\圖像\差影法\Thumbs.db
............此處省略251個(gè)文件信息
評(píng)論
共有 條評(píng)論