?? imageprocessingview.cpp
字號:
*/
//DEL void CImageProcessingView::OnEnhanceSharpFreq()
//DEL {
//DEL // TODO: Add your command handler code here
//DEL //更改光標形狀
//DEL BeginWaitCursor();
//DEL
//DEL CImageProcessingDoc * pDoc = (CImageProcessingDoc *)this->GetDocument();
//DEL CDib * pDib = pDoc->m_pDibInit;
//DEL
//DEL LPBITMAPINFOHEADER lpBMIH=pDib->m_lpBMIH;
//DEL
//DEL // 判斷是否是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 int y;
//DEL int x;
//DEL
//DEL CSize sizeImage = pDib->GetDimensions();
//DEL int nWidth = sizeImage.cx ;
//DEL int nHeight= sizeImage.cy ;
//DEL
//DEL int nSaveWidth = pDib->GetDibSaveDim().cx;
//DEL
//DEL // 開辟內存,存儲圖象數據,該數據的存儲不是DWORD對齊的
//DEL unsigned char * pUnchImage = new unsigned char[nWidth*nHeight];
//DEL
//DEL for(y=0; y<nHeight; y++)
//DEL {
//DEL for(x=0; x<nWidth; x++)
//DEL {
//DEL pUnchImage[y*nWidth+x] = pDib->m_lpImage[y*nSaveWidth+x];
//DEL }
//DEL }
//DEL
//DEL // 調用高通濾波函數進行圖象增強
//DEL HighPassFilterEnhance(pUnchImage, nWidth, nHeight, 50) ;
//DEL
//DEL // 增強以后的圖象拷貝到pDib中,進行顯示
//DEL for(y=0; y<nHeight; y++)
//DEL {
//DEL for(x=0; x<nWidth; x++)
//DEL {
//DEL pDib->m_lpImage[y*nSaveWidth+x] = pUnchImage[y*nWidth+x];
//DEL }
//DEL }
//DEL
//DEL // 釋放內存
//DEL delete []pUnchImage;
//DEL pUnchImage = NULL ;
//DEL
//DEL // 恢復光標形狀
//DEL EndWaitCursor();
//DEL
//DEL // 設置臟標記
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新視圖
//DEL pDoc->UpdateAllViews(NULL);
//DEL }
/*************************************************************************
*
* \函數名稱:
* OnEnhanceButtHight()
*
* \輸入參數:
* 無
*
* \返回值:
* 無
*
* \說明:
* 該函數利用Butterworth高通濾波實現圖象平滑
*
************************************************************************
*/
//DEL void CImageProcessingView::OnEnhanceButtHight()
//DEL {
//DEL //更改光標形狀
//DEL BeginWaitCursor();
//DEL
//DEL CImageProcessingDoc * pDoc = (CImageProcessingDoc *)this->GetDocument();
//DEL CDib * pDib = pDoc->m_pDibInit;
//DEL
//DEL LPBITMAPINFOHEADER lpBMIH=pDib->m_lpBMIH;
//DEL
//DEL // 判斷是否是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 int y;
//DEL int x;
//DEL
//DEL CSize sizeImage = pDib->GetDimensions();
//DEL int nWidth = sizeImage.cx ;
//DEL int nHeight= sizeImage.cy ;
//DEL
//DEL int nSaveWidth = pDib->GetDibSaveDim().cx;
//DEL
//DEL // 開辟內存,存儲圖象數據,該數據的存儲不是DWORD對齊的
//DEL unsigned char * pUnchImage = new unsigned char[nWidth*nHeight];
//DEL
//DEL for(y=0; y<nHeight; y++)
//DEL {
//DEL for(x=0; x<nWidth; x++)
//DEL {
//DEL pUnchImage[y*nWidth+x] = pDib->m_lpImage[y*nSaveWidth+x];
//DEL }
//DEL }
//DEL
//DEL // 調用ButterWorth高通濾波函數進行圖象增強
//DEL ButterWorthHighPass(pUnchImage, nWidth, nHeight, nWidth/2) ;
//DEL
//DEL // 增強以后的圖象拷貝到pDib中,進行顯示
//DEL for(y=0; y<nHeight; y++)
//DEL {
//DEL for(x=0; x<nWidth; x++)
//DEL {
//DEL pDib->m_lpImage[y*nSaveWidth+x] = pUnchImage[y*nWidth+x];
//DEL }
//DEL }
//DEL
//DEL // 釋放內存
//DEL delete []pUnchImage;
//DEL pUnchImage = NULL ;
//DEL
//DEL // 恢復光標形狀
//DEL EndWaitCursor();
//DEL
//DEL // 設置臟標記
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新視圖
//DEL pDoc->UpdateAllViews(NULL);
//DEL
//DEL }
/*************************************************************************
*
* \函數名稱:
* OnRegionsegFix()
*
* \輸入參數:
* 無
*
* \返回值:
* 無
*
* \說明:
* 實現并行區域分割
*
************************************************************************
*/
//DEL void CImageProcessingView::OnRegionsegFix()
//DEL {
//DEL // TODO: Add your command handler code here
//DEL
//DEL //更改光標形狀
//DEL BeginWaitCursor();
//DEL
//DEL CImageProcessingDoc * pDoc = (CImageProcessingDoc *)this->GetDocument();
//DEL CDib * pDib = pDoc->m_pDibInit;
//DEL
//DEL LPBITMAPINFOHEADER lpBMIH=pDib->m_lpBMIH;
//DEL
//DEL // 判斷是否是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 RegionSegFixThreshold(pDib,200);
//DEL
//DEL // 恢復光標形狀
//DEL EndWaitCursor();
//DEL
//DEL // 設置臟標記
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新視圖
//DEL pDoc->UpdateAllViews(NULL);
//DEL }
/*************************************************************************
*
* \函數名稱:
* OnAdaRegionSeg()
*
* \輸入參數:
* 無
*
* \返回值:
* 無
*
* \說明:
* 實現自適應區域分割算法
*
************************************************************************
*/
//DEL void CImageProcessingView::OnAdaRegionSeg()
//DEL {
//DEL // TODO: Add your command handler code here
//DEL
//DEL //更改光標形狀
//DEL BeginWaitCursor();
//DEL
//DEL CImageProcessingDoc * pDoc = (CImageProcessingDoc *)this->GetDocument();
//DEL CDib * pDib = pDoc->m_pDibInit;
//DEL
//DEL LPBITMAPINFOHEADER lpBMIH=pDib->m_lpBMIH;
//DEL
//DEL // 判斷是否是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 RegionSegAdaptive(pDib);
//DEL
//DEL // 恢復光標形狀
//DEL EndWaitCursor();
//DEL
//DEL // 設置臟標記
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新視圖
//DEL pDoc->UpdateAllViews(NULL);
//DEL
//DEL }
/*************************************************************************
*
* \函數名稱:
* OnEdgeRoberts()
*
* \輸入參數:
* 無
*
* \返回值:
* 無
*
* \說明:
* 實現并行邊界分割-Roberts算子
*
************************************************************************
*/
//DEL void CImageProcessingView::OnEdgeRoberts()
//DEL {
//DEL // TODO: Add your command handler code here
//DEL
//DEL //更改光標形狀
//DEL BeginWaitCursor();
//DEL
//DEL // 循環控制變量
//DEL int y;
//DEL int x;
//DEL
//DEL CImageProcessingDoc * pDoc = (CImageProcessingDoc *)this->GetDocument();
//DEL CDib * pDib = pDoc->m_pDibInit;
//DEL
//DEL LPBITMAPINFOHEADER lpBMIH=pDib->m_lpBMIH;
//DEL
//DEL // 判斷是否是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 CSize sizeImage = pDib->GetDimensions();
//DEL int nWidth = sizeImage.cx ;
//DEL int nHeight = sizeImage.cy ;
//DEL
//DEL // 指向梯度數據的指針
//DEL double * pdGrad;
//DEL
//DEL // 按照圖像的大小開辟內存空間,存儲梯度計算的結果
//DEL pdGrad=new double[nHeight*nWidth];
//DEL
//DEL //圖像數據的指針
//DEL LPBYTE pImageData = pDib->m_lpImage;
//DEL
//DEL // 圖像在計算機在存儲中的實際大小
//DEL CSize sizeImageSave = pDib->GetDibSaveDim();
//DEL
//DEL // 圖像在內存中每一行象素占用的實際空間
//DEL int nSaveWidth = sizeImageSave.cx;
//DEL
//DEL // 應用Roberts算子求梯度
//DEL RobertsOperator(pDib, pdGrad);
//DEL
//DEL
//DEL for(y=0; y<nHeight ; y++ )
//DEL for(x=0 ; x<nWidth ; x++ )
//DEL {
//DEL if(*(pdGrad+y*nWidth+x)>50)
//DEL *( pImageData+y*nSaveWidth+x )=0;
//DEL else
//DEL *( pImageData+y*nSaveWidth+x )=255;
//DEL }
//DEL
//DEL //釋放梯度結果使用的內存空間
//DEL delete pdGrad;
//DEL pdGrad=NULL;
//DEL
//DEL // 恢復光標形狀
//DEL EndWaitCursor();
//DEL
//DEL // 設置臟標記
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新視圖
//DEL pDoc->UpdateAllViews(NULL);
//DEL }
/*************************************************************************
*
* \函數名稱:
* OnEdgeSobel()
*
* \輸入參數:
* 無
*
* \返回值:
* 無
*
* \說明:
* 實現并行邊界分割-Sobel算子
*
************************************************************************
*/
//DEL void CImageProcessingView::OnEdgeSobel()
//DEL {
//DEL // TODO: Add your command handler code here
//DEL
//DEL //更改光標形狀
//DEL BeginWaitCursor();
//DEL
//DEL // 循環控制變量
//DEL int y;
//DEL int x;
//DEL
//DEL CImageProcessingDoc * pDoc = (CImageProcessingDoc *)this->GetDocument();
//DEL CDib * pDib = pDoc->m_pDibInit;
//DEL
//DEL LPBITMAPINFOHEADER lpBMIH=pDib->m_lpBMIH;
//DEL
//DEL // 判斷是否是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 CSize sizeImage = pDib->GetDimensions();
//DEL int nWidth = sizeImage.cx ;
//DEL int nHeight = sizeImage.cy ;
//DEL
//DEL // 指向梯度數據的指針
//DEL double * pdGrad;
//DEL
//DEL // 按照圖像的大小開辟內存空間,存儲梯度計算的結果
//DEL pdGrad=new double[nHeight*nWidth];
//DEL
//DEL //圖像數據的指針
//DEL LPBYTE lpImage = pDib->m_lpImage;
//DEL
//DEL // 圖像在計算機在存儲中的實際大小
//DEL CSize sizeImageSave = pDib->GetDibSaveDim();
//DEL
//DEL // 圖像在內存中每一行象素占用的實際空間
//DEL int nSaveWidth = sizeImageSave.cx;
//DEL
//DEL // 應用Sobel算子求梯度
//DEL SobelOperator(pDib, pdGrad);
//DEL
//DEL
//DEL for(y=0; y<nHeight ; y++ )
//DEL for(x=0 ; x<nWidth ; x++ )
//DEL {
//DEL if(*(pdGrad+y*nWidth+x)>50)
//DEL *( lpImage+y*nSaveWidth+x )=0;
//DEL else
//DEL *( lpImage+y*nSaveWidth+x )=255;
//DEL }
//DEL
//DEL //釋放內存空間
//DEL delete []pdGrad;
//DEL pdGrad=NULL;
//DEL
//DEL // 恢復光標形狀
//DEL EndWaitCursor();
//DEL
//DEL // 設置臟標記
//DEL pDoc->SetModifiedFlag(TRUE);
//DEL
//DEL // 更新視圖
//DEL pDoc->UpdateAllViews(NULL);
//DEL }
/*************************************************************************
*
* \函數名稱:
* OnEdgePrewitt()
*
* \輸入參數:
* 無
*
* \返回值:
* 無
*
* \說明:
* 實現并行邊界分割-Prewitt算子
*
************************************************************************
*/
//DEL void CImageProcessingView::OnEdgePrewitt()
//DEL {
//DEL // TODO: Add your command handler code here
//DEL
//DEL //更改光標形狀
//DEL BeginWaitCursor();
//DEL
//DEL // 循環控制變量
//DEL int y;
//DEL int x;
//DEL
//DEL CImageProcessingDoc * pDoc = (CImageProcessingDoc *)this->GetDocument();
//DEL CDib * pDib = pDoc->m_pDibInit;
//DEL
//DEL LPBITMAPINFOHEADER lpBMIH=pDib->m_lpBMIH;
//DEL
//DEL // 判斷是否是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 CSize sizeImage = pDib->GetDimensions();
//DEL int nWidth = sizeImage.cx ;
//DEL int nHeight = sizeImage.cy ;
//DEL
//DEL // 指向梯度數據的指針
//DEL double * pdGrad;
//DEL
//DEL // 按照圖像的大小開辟內存空間,存儲梯度計算的結果
//DEL pdGrad=new double[nHeight*nWidth];
//DEL
//DEL //圖像數據的指針
//DEL LPBYTE lpImage = pDib->m_lpImage;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -