?? imageprocessingview.cpp
字號(hào):
//DEL
//DEL // 獲取文檔
//DEL CImageProcessingDoc* pDoc = GetDocument();
//DEL
//DEL // 獲得圖象CDib類的指針
//DEL CDib * pDib = pDoc->m_pDibInit;
//DEL
//DEL // 獲得圖象的頭文件信息
//DEL LPBITMAPINFOHEADER lpBMIH=pDib->m_lpBMIH;
//DEL
//DEL // 判斷是否是8-bpp位圖(這里為了方便,只處理8-bpp位圖的離散霍特林變換)
//DEL if (lpBMIH->biBitCount != 8)
//DEL {
//DEL // 提示用戶
//DEL MessageBox("目前只支持256色位圖的離散霍特林變換!", "系統(tǒng)提示" ,
//DEL MB_ICONINFORMATION | MB_OK);
//DEL
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 圖象的霍特林變換
//DEL DIBHOTELLING(pDib);
//DEL
//DEL // 設(shè)置臟標(biāo)記
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新視圖
//DEL pDoc->UpdateAllViews(NULL);
//DEL
//DEL // 恢復(fù)光標(biāo)
//DEL EndWaitCursor();
//DEL
//DEL }
//DEL void CImageProcessingView::OnFreqWalsh()
//DEL {
//DEL // 圖象的沃爾什-哈達(dá)瑪變換
//DEL
//DEL // 更改光標(biāo)形狀
//DEL BeginWaitCursor();
//DEL
//DEL // 獲取文檔
//DEL CImageProcessingDoc* pDoc = GetDocument();
//DEL
//DEL // 獲得圖象CDib類的指針
//DEL CDib * pDib = pDoc->m_pDibInit;
//DEL
//DEL // 獲得圖象的頭文件信息
//DEL LPBITMAPINFOHEADER lpBMIH=pDib->m_lpBMIH;
//DEL
//DEL // 判斷是否是8-bpp位圖(這里為了方便,只處理8-bpp位圖的沃爾什-哈達(dá)瑪變換)
//DEL if (lpBMIH->biBitCount != 8)
//DEL {
//DEL // 提示用戶
//DEL MessageBox("目前只支持256色位圖的離散沃爾什變換!", "系統(tǒng)提示" ,
//DEL MB_ICONINFORMATION | MB_OK);
//DEL
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 進(jìn)行沃爾什-哈達(dá)瑪變換
//DEL DIBWalsh(pDib);
//DEL
//DEL // 設(shè)置臟標(biāo)記
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新視圖
//DEL pDoc->UpdateAllViews(NULL);
//DEL
//DEL // 恢復(fù)光標(biāo)
//DEL EndWaitCursor();
//DEL
//DEL }
/*************************************************************************
*
* \函數(shù)名稱:
* OnViewHistogram()
*
* \輸入?yún)?shù):
* 無
*
* \返回值:
* 無
*
* \說明:
* 查看直方圖,彈出直方圖顯示界面
*
*************************************************************************
*/
//DEL void CImageProcessingView::OnViewHistogram()
//DEL {
//DEL // 獲取文檔
//DEL CImageProcessingDoc* pDoc = GetDocument();
//DEL
//DEL // DIB的顏色數(shù)目
//DEL int nColorTableEntries;
//DEL nColorTableEntries = pDoc->m_pDibInit->m_nColorTableEntries;
//DEL
//DEL // 判斷是否是8bpp位圖(這里只處理8bpp位圖)
//DEL if ( nColorTableEntries != 256)
//DEL {
//DEL // 提示用戶,不再進(jìn)行處理
//DEL MessageBox("目前只支持查看256色位圖灰度直方圖!", "系統(tǒng)提示" , MB_ICONINFORMATION | MB_OK);
//DEL
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 更改光標(biāo)形狀
//DEL BeginWaitCursor();
//DEL
//DEL // 創(chuàng)建對(duì)話框
//DEL CDlgHistShow dlgHistShow;
//DEL
//DEL // 初始化變量值
//DEL dlgHistShow.m_pDib = pDoc->m_pDibInit;
//DEL
//DEL // 顯示對(duì)話框
//DEL if (dlgHistShow.DoModal() != IDOK)
//DEL {
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 恢復(fù)光標(biāo)
//DEL EndWaitCursor();
//DEL }
/*************************************************************************
*
* \函數(shù)名稱:
* OnEnhanceSmooth()
*
* \輸入?yún)?shù):
* 無
*
* \返回值:
* 無
*
* \說明:
* 對(duì)圖象進(jìn)行平滑處理,并彈出平滑模板設(shè)置對(duì)話框
*
*************************************************************************
*/
//DEL void CImageProcessingView::OnEnhanceSmooth()
//DEL {
//DEL // TODO: Add your command handler code here
//DEL // 圖像平滑
//DEL
//DEL // 獲取文檔
//DEL CImageProcessingDoc* pDoc = GetDocument();
//DEL
//DEL // 模板高度
//DEL int nTempHeight;
//DEL
//DEL // 模板寬度
//DEL int nTempWidth;
//DEL
//DEL // 模板系數(shù)
//DEL double dbTempCoef;
//DEL
//DEL // 模板中心元素X坐標(biāo)
//DEL int nTempCenX;
//DEL
//DEL // 模板中心元素Y坐標(biāo)
//DEL int nTempCenY;
//DEL
//DEL // 模板元素?cái)?shù)組
//DEL double pdbTemp[25];
//DEL
//DEL // 判斷是否是8-bpp位圖(這里為了方便,只處理8-bpp位圖的平滑,其它的可以類推)
//DEL if(pDoc->m_pDibInit->m_nColorTableEntries != 256)
//DEL //if (::DIBNumColors(lpDIB) != 256)
//DEL {
//DEL // 提示用戶
//DEL MessageBox("目前只支持256色位圖的平滑!", "系統(tǒng)提示" ,
//DEL MB_ICONINFORMATION | MB_OK);
//DEL
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 創(chuàng)建對(duì)話框
//DEL CDlgSmooth dlgSmth;
//DEL
//DEL // 給模板數(shù)組賦初值(為平均模板)
//DEL pdbTemp[0] = 1.0;
//DEL pdbTemp[1] = 1.0;
//DEL pdbTemp[2] = 1.0;
//DEL pdbTemp[3] = 0.0;
//DEL pdbTemp[4] = 0.0;
//DEL pdbTemp[5] = 1.0;
//DEL pdbTemp[6] = 1.0;
//DEL pdbTemp[7] = 1.0;
//DEL pdbTemp[8] = 0.0;
//DEL pdbTemp[9] = 0.0;
//DEL pdbTemp[10] = 1.0;
//DEL pdbTemp[11] = 1.0;
//DEL pdbTemp[12] = 1.0;
//DEL pdbTemp[13] = 0.0;
//DEL pdbTemp[14] = 0.0;
//DEL pdbTemp[15] = 0.0;
//DEL pdbTemp[16] = 0.0;
//DEL pdbTemp[17] = 0.0;
//DEL pdbTemp[18] = 0.0;
//DEL pdbTemp[19] = 0.0;
//DEL pdbTemp[20] = 0.0;
//DEL pdbTemp[21] = 0.0;
//DEL pdbTemp[22] = 0.0;
//DEL pdbTemp[23] = 0.0;
//DEL pdbTemp[24] = 0.0;
//DEL
//DEL // 初始化對(duì)話框變量值
//DEL dlgSmth.m_nTemType = 0;
//DEL dlgSmth.m_nSmthTemHeight = 3;
//DEL dlgSmth.m_nSmthTemWidth = 3;
//DEL dlgSmth.m_nSmthTemCenX = 1;
//DEL dlgSmth.m_nSmthTemCenY = 1;
//DEL dlgSmth.m_dbSmthTemCoef = (double) (1.0 / 9.0);
//DEL dlgSmth.m_pdbTemp = pdbTemp;
//DEL
//DEL // 顯示對(duì)話框,提示用戶設(shè)定平移量
//DEL if (dlgSmth.DoModal() != IDOK)
//DEL {
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 獲取用戶設(shè)定的平移量
//DEL nTempHeight = dlgSmth.m_nSmthTemHeight;
//DEL nTempWidth = dlgSmth.m_nSmthTemWidth;
//DEL nTempCenX = dlgSmth.m_nSmthTemCenX;
//DEL nTempCenY = dlgSmth.m_nSmthTemCenY;
//DEL dbTempCoef = dlgSmth.m_dbSmthTemCoef;
//DEL
//DEL // 刪除對(duì)話框
//DEL delete dlgSmth;
//DEL
//DEL // 更改光標(biāo)形狀
//DEL BeginWaitCursor();
//DEL
//DEL // 調(diào)用Template()函數(shù)平滑DIB
//DEL if (GeneralTemplate(pDoc->m_pDibInit, nTempWidth, nTempHeight,
//DEL nTempCenX, nTempCenY, pdbTemp, dbTempCoef))
//DEL {
//DEL // 設(shè)置臟標(biāo)記
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新視圖
//DEL pDoc->UpdateAllViews(NULL);
//DEL }
//DEL else
//DEL {
//DEL // 提示用戶
//DEL MessageBox("分配內(nèi)存失敗!", "系統(tǒng)提示" , MB_ICONINFORMATION | MB_OK);
//DEL }
//DEL
//DEL // 恢復(fù)光標(biāo)
//DEL EndWaitCursor();
//DEL
//DEL }
/*************************************************************************
*
* \函數(shù)名稱:
* OnEnhanceMedian()
*
* \輸入?yún)?shù):
* 無
*
* \返回值:
* 無
*
* \說明:
* 對(duì)圖象進(jìn)行中值濾波,并彈出平滑模板設(shè)置對(duì)話框
*
*************************************************************************
*/
//DEL void CImageProcessingView::OnEnhanceMedian()
//DEL {
//DEL // 中值濾波
//DEL
//DEL // 獲取文檔
//DEL CImageProcessingDoc* pDoc = GetDocument();
//DEL
//DEL // 濾波器的高度
//DEL int nFilterHeight;
//DEL
//DEL // 濾波器的寬度
//DEL int nFilterWidth;
//DEL
//DEL // 中心元素的X坐標(biāo)
//DEL int nFilterCenX;
//DEL
//DEL // 中心元素的Y坐標(biāo)
//DEL int nFilterCenY;
//DEL
//DEL // 判斷是否是8-bpp位圖(這里為了方便,只處理8-bpp位圖的平滑,其它的可以類推)
//DEL if(pDoc->m_pDibInit->m_nColorTableEntries != 256)
//DEL {
//DEL // 提示用戶
//DEL MessageBox("目前只支持256色位圖的平滑!", "系統(tǒng)提示" ,
//DEL MB_ICONINFORMATION | MB_OK);
//DEL
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL
//DEL // 創(chuàng)建對(duì)話框
//DEL CDlgMedian dlgMedian;
//DEL
//DEL // 初始化變量值
//DEL dlgMedian.m_nFilterType = 0;
//DEL dlgMedian.m_nFilterHeight = 3;
//DEL dlgMedian.m_nFilterWidth = 1;
//DEL dlgMedian.m_nFilterCenX = 0;
//DEL dlgMedian.m_nFilterCenY = 1;
//DEL
//DEL // 顯示對(duì)話框,提示用戶設(shè)定平移量
//DEL if (dlgMedian.DoModal() != IDOK)
//DEL {
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 獲取用戶的設(shè)定
//DEL nFilterHeight = dlgMedian.m_nFilterHeight;
//DEL nFilterWidth = dlgMedian.m_nFilterWidth;
//DEL nFilterCenX = dlgMedian.m_nFilterCenX;
//DEL nFilterCenY = dlgMedian.m_nFilterCenY;
//DEL
//DEL // 刪除對(duì)話框
//DEL delete dlgMedian;
//DEL
//DEL // 更改光標(biāo)形狀
//DEL BeginWaitCursor();
//DEL
//DEL // 調(diào)用MedianFilter()函數(shù)中值濾波
//DEL if (MedianFilter(pDoc->m_pDibInit, nFilterWidth,
//DEL nFilterHeight, nFilterCenX, nFilterCenY ))
//DEL
//DEL {
//DEL // 設(shè)置臟標(biāo)記
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新視圖
//DEL pDoc->UpdateAllViews(NULL);
//DEL }
//DEL else
//DEL {
//DEL // 提示用戶
//DEL MessageBox("分配內(nèi)存失敗!", "系統(tǒng)提示" , MB_ICONINFORMATION | MB_OK);
//DEL }
//DEL
//DEL // 恢復(fù)光標(biāo)
//DEL EndWaitCursor();
//DEL
//DEL // 設(shè)置臟標(biāo)記
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新視圖
//DEL pDoc->UpdateAllViews(NULL);
//DEL
//DEL }
//DEL void CImageProcessingView::OnEnhancePseudcolor()
//DEL {
//DEL // 偽彩色編碼
//DEL
//DEL // 獲取文檔
//DEL CImageProcessingDoc* pDoc = GetDocument();
//DEL
//DEL // 保存用戶選擇的偽彩色編碼表索引
//DEL int nColor;
//DEL
//DEL // 判斷是否是8-bpp位圖(這里為了方便,只處理8-bpp位圖的平滑,其它的可以類推)
//DEL if(pDoc->m_pDibInit->m_nColorTableEntries != 256)
//DEL {
//DEL // 提示用戶
//DEL MessageBox("目前只支持256色位圖的偽彩色變換!", "系統(tǒng)提示" ,
//DEL MB_ICONINFORMATION | MB_OK);
//DEL
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 參數(shù)對(duì)話框
//DEL CDlgEnhColor dlgPara;
//DEL
//DEL // 初始化變量值
//DEL if (pDoc->m_nColorIndex >= 0)
//DEL {
//DEL // 初始選中當(dāng)前的偽彩色
//DEL dlgPara.m_nColor = pDoc->m_nColorIndex;
//DEL }
//DEL else
//DEL {
//DEL // 初始選中灰度偽彩色編碼表
//DEL dlgPara.m_nColor = 0;
//DEL }
//DEL
//DEL // 指向名稱數(shù)組的指針
//DEL dlgPara.m_lpColorName = (LPSTR) ColorScaleName;
//DEL
//DEL // 偽彩色編碼數(shù)目
//DEL dlgPara.m_nColorCount = COLOR_SCALE_COUNT;
//DEL
//DEL // 名稱字符串長度
//DEL dlgPara.m_nNameLen = sizeof(ColorScaleName) / COLOR_SCALE_COUNT;
//DEL
//DEL // 顯示對(duì)話框,提示用戶設(shè)定平移量
//DEL if (dlgPara.DoModal() != IDOK)
//DEL {
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 獲取用戶的設(shè)定
//DEL nColor = dlgPara.m_nColor;
//DEL
//DEL // 刪除對(duì)話框
//DEL delete dlgPara;
//DEL
//DEL // 更改光標(biāo)形狀
//DEL BeginWaitCursor();
//DEL
//DEL // 判斷偽彩色編碼是否改動(dòng)
//DEL if (pDoc->m_nColorIndex != nColor)
//DEL {
//DEL // 調(diào)用ReplaceColorPal()函數(shù)變換調(diào)色板
//DEL ReplaceDIBColorTable(pDoc->m_pDibInit, (LPBYTE)ColorsTable[nColor]);
//DEL
//DEL // 更新調(diào)色板
//DEL pDoc->m_pDibInit->MakePalette();
//DEL
//DEL // 更新類成員變量
//DEL pDoc->m_nColorIndex = nColor;
//DEL
//DEL // 設(shè)置臟標(biāo)記
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新視圖
//DEL pDoc->UpdateAllViews(NULL);
//DEL }
//DEL
//DEL
//DEL // 恢復(fù)光標(biāo)
//DEL EndWaitCursor();
//DEL }
//DEL void CImageProcessingView::OnTransDwt()
//DEL {
//DEL // 獲得文檔類指針
//DEL CImageProcessingDoc * pDoc = (CImageProcessingDoc *)this->GetDocument();
//DEL
//DEL // 指向圖象的指針
//DEL CDib * pDib = pDoc->m_pDibInit;
//DEL
//DEL // 更改光標(biāo)形狀
//DEL BeginWaitCursor();
//DEL
//DEL // 進(jìn)行小波變換
//DEL int rsl = DIBDWTStep(pDib,0);
//DEL
//DEL // 恢復(fù)光標(biāo)形狀
//DEL EndWaitCursor();
//DEL
//DEL // 如果小波變換不成功,則直接返回
//DEL if (!rsl)
//DEL return;
//DEL
//DEL // 設(shè)置臟標(biāo)志
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新顯示
//DEL pDoc->UpdateAllViews(FALSE);
//DEL }
//DEL void CImageProcessingView::OnTransIdwt()
//DEL {
//DEL // 獲得文檔類指針
//DEL CImageProcessingDoc * pDoc = (CImageProcessingDoc *)this->GetDocument();
//DEL
//DEL // 指向圖象的指針
//DEL CDib * pDib = pDoc->m_pDibInit;
//DEL
//DEL // 更改光標(biāo)形狀
//DEL BeginWaitCursor();
//DEL
//DEL // 進(jìn)行小波反變換
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -