欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
均值濾波器 ( Mean Filter ) C++ 實(shí)現
 
均值濾波器就是在圖像處理的時(shí)候, “把每個(gè)像素都用周?chē)?個(gè)像素來(lái)做均值操作 ”, 比如說(shuō)這里有一個(gè)例子:
 
        非常明顯, 這個(gè)3*3區域像素的顏色值分別是5,3,6,2,1,9,8,4,7那么中間的1這個(gè)像素的過(guò)濾后的值就是這些值的平均值, 也就是前面的計算方法: (5+3+6+2+1+9+8+4+7)/9=5一目了然。
        那么這個(gè)均值濾波器有什么用處呢?主要還是平滑圖像的用處, 有的圖像的銳度很高,用這樣的均值算法,可以把銳度降低。使得圖像看上去更加自然,下面就有幾幅圖我們可以看出一些端倪:
原圖:
   
                                                                      
平滑處理之后:
 
       這里還是可以明顯的感覺(jué)到不同的, 沒(méi)有好壞之分,就是第二幅圖片看上去更為平滑。  那這里均值平滑是否具有去除噪聲的功能呢? 我們搞來(lái)了椒鹽噪聲(就是隨機的白點(diǎn),黑點(diǎn))來(lái)試試手:
噪聲圖(5%):  
     
           
平滑處理之后:
 
       首先這里的噪聲還是比較小的, 只有5%,從均值的效果來(lái)看的話(huà), 我可以說(shuō)幾乎沒(méi)有用,其實(shí)直觀(guān)的想也可以判斷, 因為這里的處理并沒(méi)有剔除這些噪聲點(diǎn), 而只是微弱地降低了噪聲,所以效果可以想見(jiàn)的。。
一段處理的代碼:
view plaincopy to clipboardprint?
/** 
** method to remove noise from the corrupted image by mean value 
* @param corrupted input grayscale binary array with corrupted info 
* @param smooth output data for smooth result, the memory need to be allocated outside of the function 
* @param width width of the input grayscale image 
* @param height height of the input grayscale image 
*/ 
void meanFilter (unsigned char* corrupted, unsigned char* smooth, int width, int height)  
{  
      
    memcpy ( smooth, corrupted, width*height*sizeof(unsigned char) );  
      
    for (int j=1;j<height-1;j++)  
    {  
        for (int i=1;i<width-1;i++)  
        {  
            smooth [ j*width+i ] = (    corrupted [ (j-1)*width+(i-1) ] + corrupted [ (j-1)*width+i] + corrupted [ (j-1)*width+(i+1) ] +   
                                       corrupted [ j*width+(i-1) ]     + corrupted [ j*width+i]     + corrupted [ j*width+(i+1) ] +  
                                        corrupted [ (j+1)*width+(i-1) ] + corrupted [ (j+1)*width+i] + corrupted [ (j+1)*width+(i+1) ] ) / 9;  
        }  
    }  

/**
** method to remove noise from the corrupted image by mean value
* @param corrupted input grayscale binary array with corrupted info
* @param smooth output data for smooth result, the memory need to be allocated outside of the function
* @param width width of the input grayscale image
* @param height height of the input grayscale image
*/
void meanFilter (unsigned char* corrupted, unsigned char* smooth, int width, int height)
{
 
 memcpy ( smooth, corrupted, width*height*sizeof(unsigned char) );
 
 for (int j=1;j<height-1;j++)
 {
  for (int i=1;i<width-1;i++)
  {
   smooth [ j*width+i ] = ( corrupted [ (j-1)*width+(i-1) ] + corrupted [ (j-1)*width+i] + corrupted [ (j-1)*width+(i+1) ] +
          corrupted [ j*width+(i-1) ]  + corrupted [ j*width+i]  + corrupted [ j*width+(i+1) ] +
          corrupted [ (j+1)*width+(i-1) ] + corrupted [ (j+1)*width+i] + corrupted [ (j+1)*width+(i+1) ] ) / 9;
  }
 }
}
一般處理的時(shí)候通常還有邊界上的一些處理, 這里就簡(jiǎn)單的從1...width-1來(lái)處理, 所以第一個(gè)和最后一個(gè)像素就簡(jiǎn)單的拋掉了, 如果只是簡(jiǎn)單的看看效果還是沒(méi)有問(wèn)題的!
 
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
圖像銳化算法 C++ 實(shí)現
圖像處理基本算法
H.264 display routines for Win32
視音頻數據處理入門(mén):RGB、YUV像素數據處理
OTSU算法提取圖像閾值的C語(yǔ)言實(shí)現 - Steven Wang's Blog
Linux下利用libjpeg實(shí)現bmp與jpg相互轉換C代碼
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久