-
大小: 29.12MB文件類型: .zip金幣: 1下載: 0 次發布日期: 2023-07-17
- 語言: C/C++
- 標簽:
資源簡介
何斌Visual C++數字圖像處理第二版原書pdf版本+光盤源代碼
學習圖像處理的經典教材
代碼片段和文件信息
//?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?interpr
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-07-17?15:36??VC數字圖像處理(何斌)\
?????目錄???????????0??2008-03-14?12:59??VC數字圖像處理(何斌)\VC數字圖像處理光盤\
?????目錄???????????0??2008-03-14?12:59??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\
?????文件???????33120??2001-12-28?08:24??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\bacteria.BMP
?????文件???????66616??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\Couple.bmp
?????文件???????42240??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\dragon1.bmp
?????文件??????172800??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\DRAGON_256_1.bmp
?????文件??????262710??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\heci1.bmp
?????目錄???????????0??2008-03-14?12:59??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\Hough變換\
?????文件??????110414??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\Hough變換\result.bmp
?????文件??????110416??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\Hough變換\source.bmp
?????文件????????5632??2007-01-23?10:28??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\Hough變換\Thumbs.db
?????文件???????66616??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\rec1.bmp
?????文件???????66616??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\rec2.bmp
?????文件??????205306??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\test.bmp
?????文件???????31232??2007-01-23?10:28??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\Thumbs.db
?????文件??????308278??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\view.bmp
?????目錄???????????0??2008-03-14?12:59??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\圖像復原\
?????文件???????66616??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\圖像復原\Miss.bmp
?????文件???????66614??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\圖像復原\Miss01.bmp
?????文件???????66614??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\圖像復原\Miss02.bmp
?????文件???????66614??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\圖像復原\Miss03.bmp
?????文件???????66614??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\圖像復原\Miss04.bmp
?????文件???????66614??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\圖像復原\Miss05.bmp
?????文件???????66614??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\圖像復原\noise.bmp
?????文件???????66614??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\圖像復原\noise1.bmp
?????文件????????8704??2007-01-23?10:28??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\圖像復原\Thumbs.db
?????目錄???????????0??2008-03-14?12:59??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\差影法\
?????文件???????66614??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\差影法\result.bmp
?????文件???????66614??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\差影法\source.bmp
?????文件???????66616??2001-12-22?02:40??VC數字圖像處理(何斌)\VC數字圖像處理光盤\圖像\差影法\template.bmp
............此處省略208個文件信息
評論
共有 條評論