資源簡介
用于邊緣檢測的很多方法,并且考慮的精度要求用到了亞像素,比如空間矩的方法
代碼片段和文件信息
//?cdib.cpp
#include?“stdafx.h“
#include?“math.h“
#include?“process.h“
#include?“cdib.h“
#include?“GlobalApi.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
//?實例化串行化過程
IMPLEMENT_SERIAL(CDib?Cobject?0);
/*************************************************************************
?*
?*?\函數名稱:
?*???CDib()
?*
?*?\輸入參數:
?*?無
?*
?*?\返回值:
?*???無
?*
?*?\說明:
?*???構造函數
?*
?************************************************************************
?*/
CDib::CDib()
{
m_hFile??????=?NULL;
m_hBitmap????=?NULL;
m_hPalette???=?NULL;
m_nBmihAlloc?=?m_nImageAlloc?=?noAlloc;
Empty();
}
/*************************************************************************
?*
?*?\函數名稱:
?*???CDib()
?*
?*?\輸入參數:
?*?CSize size -?位圖尺寸
?*?int nBitCount -?象素位數
?*
?*?\返回值:
?*???無
?*
?*?\說明:
?*???構造函數
?*???根據給定的位圖尺寸和象素位數構造CDib對象,并對信息頭和調色板分配內存
?*???但并沒有給位圖數據分配內存
?*
?************************************************************************
?*/
CDib::CDib(CSize?size?int?nBitCount)
{
m_hFile??????=?NULL;
m_hBitmap????=?NULL;
m_hPalette???=?NULL;
m_nBmihAlloc?=?m_nImageAlloc?=?noAlloc;
Empty();
//?根據象素位數計算調色板尺寸
ComputePaletteSize(nBitCount);
//?分配DIB信息頭和調色板的內存
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;
//?計算圖象數據內存的大小,并設置此DIB的調色板的指針
ComputeMetrics();
//?將此DIB的調色板初始化為0
memset(m_lpvColorTable?0?sizeof(RGBQUAD)?*?m_nColorTableEntries);
//?暫時不分配圖象數據內存
m_lpImage?=?NULL;?
}
/*************************************************************************
?*
?*?\函數名稱:
?*???~CDib()
?*
?*?\輸入參數:
?*?無
?*
?*?\返回值:
?*???無
?*
?*?\說明:
?*???析構函數,并釋放所有分配的DIB內存
?*
?************************************************************************
?*/
CDib::~CDib()
{
Empty();
}
/*************************************************************************
?*
?*?\函數名稱:
?*???GetDimensions()
?*
?*?\輸入參數:
?*???無
?*
?*?\返回值:
?*???CSize -?DIB的寬度和高度
?*
?*?\說明:
?*???返回以象素表示的DIB的寬度和高度
?*
?************************************************************************
?*/
CSize?CDib::GetDimensions()
{
if(m_lpBMIH?==?NULL)?return?CSize(0?0);
return?CSize((int)?m_lpBMIH->biWidth?(int)?m_lpBMIH->biHeight);
}
/*************************************************************************
?*
?*?\函數名稱:
?*???AttachMapFile()
?*
?*?\輸入參數:
?*???const char*?strPathname -?映射文件的路徑名
?*???BOOL bShare
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????38873??2012-01-13?08:46??Edge_detection\cdib.cpp
?????文件???????3663??2007-06-02?17:47??Edge_detection\cdib.h
?????文件??????11948??2012-01-13?14:25??Edge_detection\Debug\BuildLog.htm
?????文件??????93556??2012-01-13?08:46??Edge_detection\Debug\cdib.obj
?????文件??????????0??2012-01-13?08:46??Edge_detection\Debug\cdib.sbr
?????文件??????30411??2012-01-13?08:47??Edge_detection\Debug\DIBPrcs.obj
?????文件??????????0??2012-01-13?08:47??Edge_detection\Debug\DIBPrcs.sbr
?????文件????9374720??2012-01-13?14:25??Edge_detection\Debug\Edge_detection.bsc
?????文件?????206848??2012-01-13?14:25??Edge_detection\Debug\Edge_detection.exe
?????文件????????920??2012-01-13?08:49??Edge_detection\Debug\Edge_detection.exe.em
?????文件????????984??2012-01-13?08:49??Edge_detection\Debug\Edge_detection.exe.em
?????文件????????861??2012-01-13?14:25??Edge_detection\Debug\Edge_detection.exe.intermediate.manifest
?????文件????1823960??2012-01-13?14:25??Edge_detection\Debug\Edge_detection.ilk
?????文件??????36447??2012-01-13?08:39??Edge_detection\Debug\Edge_detection.obj
?????文件???28704768??2012-01-13?08:39??Edge_detection\Debug\Edge_detection.pch
?????文件????4082688??2012-01-13?14:25??Edge_detection\Debug\Edge_detection.pdb
?????文件???????7908??2012-01-13?08:49??Edge_detection\Debug\Edge_detection.res
?????文件??????????0??2012-01-13?08:39??Edge_detection\Debug\Edge_detection.sbr
?????文件??????27070??2012-01-13?08:39??Edge_detection\Debug\Edge_detectionDoc.obj
?????文件??????????0??2012-01-13?08:39??Edge_detection\Debug\Edge_detectionDoc.sbr
?????文件?????157235??2012-01-13?14:25??Edge_detection\Debug\Edge_detectionView.obj
?????文件??????????0??2012-01-13?14:25??Edge_detection\Debug\Edge_detectionView.sbr
?????文件??????34822??2012-01-13?08:39??Edge_detection\Debug\MainFrm.obj
?????文件??????????0??2012-01-13?08:39??Edge_detection\Debug\MainFrm.sbr
?????文件?????????60??2012-01-13?14:25??Edge_detection\Debug\mt.dep
?????文件??????69339??2012-01-13?08:49??Edge_detection\Debug\SegApi.obj
?????文件??????????0??2012-01-13?08:49??Edge_detection\Debug\SegApi.sbr
?????文件?????465843??2012-01-13?08:39??Edge_detection\Debug\StdAfx.obj
?????文件????3360358??2012-01-13?08:39??Edge_detection\Debug\StdAfx.sbr
?????文件??????23818??2012-01-13?08:39??Edge_detection\Debug\texture.obj
............此處省略56個文件信息
- 上一篇:上傳文件demo(包含圖片壓縮多圖上傳)
- 下一篇:Linux in Action
評論
共有 條評論