📄 imageprocessingview.cpp
字号:
//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色位图的离散霍特林变换!", "系统提示" ,
//DEL MB_ICONINFORMATION | MB_OK);
//DEL
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 图象的霍特林变换
//DEL DIBHOTELLING(pDib);
//DEL
//DEL // 设置脏标记
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新视图
//DEL pDoc->UpdateAllViews(NULL);
//DEL
//DEL // 恢复光标
//DEL EndWaitCursor();
//DEL
//DEL }
//DEL void CImageProcessingView::OnFreqWalsh()
//DEL {
//DEL // 图象的沃尔什-哈达玛变换
//DEL
//DEL // 更改光标形状
//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位图的沃尔什-哈达玛变换)
//DEL if (lpBMIH->biBitCount != 8)
//DEL {
//DEL // 提示用户
//DEL MessageBox("目前只支持256色位图的离散沃尔什变换!", "系统提示" ,
//DEL MB_ICONINFORMATION | MB_OK);
//DEL
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 进行沃尔什-哈达玛变换
//DEL DIBWalsh(pDib);
//DEL
//DEL // 设置脏标记
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新视图
//DEL pDoc->UpdateAllViews(NULL);
//DEL
//DEL // 恢复光标
//DEL EndWaitCursor();
//DEL
//DEL }
/*************************************************************************
*
* \函数名称:
* OnViewHistogram()
*
* \输入参数:
* 无
*
* \返回值:
* 无
*
* \说明:
* 查看直方图,弹出直方图显示界面
*
*************************************************************************
*/
//DEL void CImageProcessingView::OnViewHistogram()
//DEL {
//DEL // 获取文档
//DEL CImageProcessingDoc* pDoc = GetDocument();
//DEL
//DEL // DIB的颜色数目
//DEL int nColorTableEntries;
//DEL nColorTableEntries = pDoc->m_pDibInit->m_nColorTableEntries;
//DEL
//DEL // 判断是否是8bpp位图(这里只处理8bpp位图)
//DEL if ( nColorTableEntries != 256)
//DEL {
//DEL // 提示用户,不再进行处理
//DEL MessageBox("目前只支持查看256色位图灰度直方图!", "系统提示" , MB_ICONINFORMATION | MB_OK);
//DEL
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 更改光标形状
//DEL BeginWaitCursor();
//DEL
//DEL // 创建对话框
//DEL CDlgHistShow dlgHistShow;
//DEL
//DEL // 初始化变量值
//DEL dlgHistShow.m_pDib = pDoc->m_pDibInit;
//DEL
//DEL // 显示对话框
//DEL if (dlgHistShow.DoModal() != IDOK)
//DEL {
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 恢复光标
//DEL EndWaitCursor();
//DEL }
/*************************************************************************
*
* \函数名称:
* OnEnhanceSmooth()
*
* \输入参数:
* 无
*
* \返回值:
* 无
*
* \说明:
* 对图象进行平滑处理,并弹出平滑模板设置对话框
*
*************************************************************************
*/
//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 // 模板系数
//DEL double dbTempCoef;
//DEL
//DEL // 模板中心元素X坐标
//DEL int nTempCenX;
//DEL
//DEL // 模板中心元素Y坐标
//DEL int nTempCenY;
//DEL
//DEL // 模板元素数组
//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色位图的平滑!", "系统提示" ,
//DEL MB_ICONINFORMATION | MB_OK);
//DEL
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 创建对话框
//DEL CDlgSmooth dlgSmth;
//DEL
//DEL // 给模板数组赋初值(为平均模板)
//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 // 初始化对话框变量值
//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 // 显示对话框,提示用户设定平移量
//DEL if (dlgSmth.DoModal() != IDOK)
//DEL {
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 获取用户设定的平移量
//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 // 删除对话框
//DEL delete dlgSmth;
//DEL
//DEL // 更改光标形状
//DEL BeginWaitCursor();
//DEL
//DEL // 调用Template()函数平滑DIB
//DEL if (GeneralTemplate(pDoc->m_pDibInit, nTempWidth, nTempHeight,
//DEL nTempCenX, nTempCenY, pdbTemp, dbTempCoef))
//DEL {
//DEL // 设置脏标记
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新视图
//DEL pDoc->UpdateAllViews(NULL);
//DEL }
//DEL else
//DEL {
//DEL // 提示用户
//DEL MessageBox("分配内存失败!", "系统提示" , MB_ICONINFORMATION | MB_OK);
//DEL }
//DEL
//DEL // 恢复光标
//DEL EndWaitCursor();
//DEL
//DEL }
/*************************************************************************
*
* \函数名称:
* OnEnhanceMedian()
*
* \输入参数:
* 无
*
* \返回值:
* 无
*
* \说明:
* 对图象进行中值滤波,并弹出平滑模板设置对话框
*
*************************************************************************
*/
//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坐标
//DEL int nFilterCenX;
//DEL
//DEL // 中心元素的Y坐标
//DEL int nFilterCenY;
//DEL
//DEL // 判断是否是8-bpp位图(这里为了方便,只处理8-bpp位图的平滑,其它的可以类推)
//DEL if(pDoc->m_pDibInit->m_nColorTableEntries != 256)
//DEL {
//DEL // 提示用户
//DEL MessageBox("目前只支持256色位图的平滑!", "系统提示" ,
//DEL MB_ICONINFORMATION | MB_OK);
//DEL
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL
//DEL // 创建对话框
//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 // 显示对话框,提示用户设定平移量
//DEL if (dlgMedian.DoModal() != IDOK)
//DEL {
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 获取用户的设定
//DEL nFilterHeight = dlgMedian.m_nFilterHeight;
//DEL nFilterWidth = dlgMedian.m_nFilterWidth;
//DEL nFilterCenX = dlgMedian.m_nFilterCenX;
//DEL nFilterCenY = dlgMedian.m_nFilterCenY;
//DEL
//DEL // 删除对话框
//DEL delete dlgMedian;
//DEL
//DEL // 更改光标形状
//DEL BeginWaitCursor();
//DEL
//DEL // 调用MedianFilter()函数中值滤波
//DEL if (MedianFilter(pDoc->m_pDibInit, nFilterWidth,
//DEL nFilterHeight, nFilterCenX, nFilterCenY ))
//DEL
//DEL {
//DEL // 设置脏标记
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新视图
//DEL pDoc->UpdateAllViews(NULL);
//DEL }
//DEL else
//DEL {
//DEL // 提示用户
//DEL MessageBox("分配内存失败!", "系统提示" , MB_ICONINFORMATION | MB_OK);
//DEL }
//DEL
//DEL // 恢复光标
//DEL EndWaitCursor();
//DEL
//DEL // 设置脏标记
//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色位图的伪彩色变换!", "系统提示" ,
//DEL MB_ICONINFORMATION | MB_OK);
//DEL
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 参数对话框
//DEL CDlgEnhColor dlgPara;
//DEL
//DEL // 初始化变量值
//DEL if (pDoc->m_nColorIndex >= 0)
//DEL {
//DEL // 初始选中当前的伪彩色
//DEL dlgPara.m_nColor = pDoc->m_nColorIndex;
//DEL }
//DEL else
//DEL {
//DEL // 初始选中灰度伪彩色编码表
//DEL dlgPara.m_nColor = 0;
//DEL }
//DEL
//DEL // 指向名称数组的指针
//DEL dlgPara.m_lpColorName = (LPSTR) ColorScaleName;
//DEL
//DEL // 伪彩色编码数目
//DEL dlgPara.m_nColorCount = COLOR_SCALE_COUNT;
//DEL
//DEL // 名称字符串长度
//DEL dlgPara.m_nNameLen = sizeof(ColorScaleName) / COLOR_SCALE_COUNT;
//DEL
//DEL // 显示对话框,提示用户设定平移量
//DEL if (dlgPara.DoModal() != IDOK)
//DEL {
//DEL // 返回
//DEL return;
//DEL }
//DEL
//DEL // 获取用户的设定
//DEL nColor = dlgPara.m_nColor;
//DEL
//DEL // 删除对话框
//DEL delete dlgPara;
//DEL
//DEL // 更改光标形状
//DEL BeginWaitCursor();
//DEL
//DEL // 判断伪彩色编码是否改动
//DEL if (pDoc->m_nColorIndex != nColor)
//DEL {
//DEL // 调用ReplaceColorPal()函数变换调色板
//DEL ReplaceDIBColorTable(pDoc->m_pDibInit, (LPBYTE)ColorsTable[nColor]);
//DEL
//DEL // 更新调色板
//DEL pDoc->m_pDibInit->MakePalette();
//DEL
//DEL // 更新类成员变量
//DEL pDoc->m_nColorIndex = nColor;
//DEL
//DEL // 设置脏标记
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新视图
//DEL pDoc->UpdateAllViews(NULL);
//DEL }
//DEL
//DEL
//DEL // 恢复光标
//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 // 更改光标形状
//DEL BeginWaitCursor();
//DEL
//DEL // 进行小波变换
//DEL int rsl = DIBDWTStep(pDib,0);
//DEL
//DEL // 恢复光标形状
//DEL EndWaitCursor();
//DEL
//DEL // 如果小波变换不成功,则直接返回
//DEL if (!rsl)
//DEL return;
//DEL
//DEL // 设置脏标志
//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 // 更改光标形状
//DEL BeginWaitCursor();
//DEL
//DEL // 进行小波反变换
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -