1. 程式人生 > 實用技巧 >數字影象處理若干影象質量評價指標

數字影象處理若干影象質量評價指標

首先幾個最基本的指標:

a)灰度圖的均值

即一幅影象所有畫素的均值,它表明了該影象是否偏暗或者偏亮,比較小的話就偏暗,較大則亮。

b)灰度圖的標準差

首先從影象質量大的分類方法來看,可分為主管評價和客觀評價!

其次,客觀評價又根據其對參考影象的依賴程度, 可分成三類。
(1)全參考:需要和參考影象上的畫素點做一一對應的比較;
(2)半參考:只需要和參考影象上的部分統計特徵做比較;
(3)無參考:不需要具體的參考影象。其中全參考演算法是研究時間最長、發展最成熟的部分

1,Peak Signal to Noise Ratio(PSNR)峰值信噪比

全參考評價方式,需要參考影象和待評價影象,是一種相似度評價指標,參考影象是清晰影象的話psnr越大越好。

其中MSE表明了兩幅影象的總體差異,越大表明差異也越明顯。

function pnsr_result = myPsnr(img_ref,img_den)    
%myPsnr Summary of this function goes here  
%   img_ref is a high quality image 
%   img_den is a noise/denoise image  
%   the function will return the PSNR of the noise/denoise image  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%author:ebowtang
%author blog:http://blog.csdn.net/ebowtang/article/details/43643037
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
width = size(img_ref,2);  
heigh = size(img_ref,1);  
if( width ~= size(img_den,2) || heigh ~= size(img_den,1) )  
    disp('Please check the input image have the same size');  
    return  
end  
[a,b]=size(img_ref);    
XX2=double(img_ref) - double(img_den);    
mse_value2 = sum(sum( XX2.^2 ))/(a*b);    
pnsr_result = 10*log10( 255*255 / mse_value2 ); %get pnsr 

 

對其進行測試:編寫正確!!!

2,Signal to Noise Ratio(SNR)信噪比

首先值得一提的是,SNR的定義方式有很多種,見參考文獻[1-3]。

其中最常見的是a)這種定義方式,這種定義方式實際意義和psnr一樣,都是一種相似度評價指標:

a)最常見的定義方式(度量影象相似度)

如果把f(x,y)看做原始圖g(x,y)和噪聲影象e(x,y)的和,輸出圖的均方信噪比就是

matlab實現如下:

function result_snr = mySnr(img_ref,img_den)
%mySnr Summary of this function goes here  
%   img_ref is a high quality image 
%   img_den is a noise/denoise image  
%   the function will return the result_snr of the noise/denoise image  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%author:ebowtang
%author blog:http://blog.csdn.net/ebowtang
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
width = size(img_ref,2);  
heigh = size(img_ref,1);  
if( width ~= size(img_den,2) || heigh ~= size(img_den,1) )  
    disp('Please check the input image have the same size');  
    return  
end 
d2=sum(sum( img_ref.^2 ));
M=double(img_ref) - double(img_den);    
d1 = sum(sum( M.^2 )); 
result_snr = 10*log10((d2/d1));

  

b)其他表示式(度量噪聲強度)

通常我們以平均值代表影像影象訊號的強度,而將選定背景區域的標準差當成噪聲的大小,因為標準差所代表的物理意義為噪聲相對該區域平均值的波動情形,這直覺上就像是噪聲載在影象訊號上一樣,SNR越大,代表影象品質越好。常見的度量噪聲強度的SNR的表示式為:

其中I表示影象,max(I)就是求取影象的最大畫素,分子則是選定的背景噪聲區域的方差(沒有根號就是標準差)

其中一種實現為:

function result_snr = mySnr1(img_den,noise_region)
%mySnr1 Summary of this function goes here  
%   img_den is a noise/denoise image  
%   noise_region is the selected regions of interest and of background noise region
%   the function will return the result_snr of the noise/denoise image  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%author:ebowtang
%author blog:http://blog.csdn.net/ebowtang
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
img_den=double(img_den);
noise_region=double(noise_region);
d2=max(max(img_den));%用影象畫素的最大值代表訊號強度
%d2=mean2(img_den);%用影象畫素的平均值代表訊號強度
d1=std2(noise_region);d1=d1+0.000001;%估計影象的噪聲標準差(可以通過選定影象背景區域得到)
result_snr = 20*log10(d2/d1);%這樣的表達形式的計算結果單位是‘db’

  

3,ContrastNoise Ratio(CNR) 對比度噪聲比

對比度噪聲比,是衡量影象對比度的一個指標。運用他的時候,首先要在待處理影象上選取感興趣區域(ROI)。見參考蚊香【4】一般情況下,這裡全部引用文獻4的說法.

CNR= 影象在感興趣的區域內外的強度差 除以 影象在感興趣的區域之內外的標準差和,並取絕對值。即內外訊號強度初一內外噪聲和。可以很直觀的想象,CNR的值越大代表內外區域越能被分辨出來,表示影像的對比度越好。

根據完論文的描述,於是我們可以得到程式碼如下

function result_cnr = myCnr(noise_region,roi1,roi2,roi3,roi4)
%myCnr Summary of this function goes here  
%   img_den is a noise/denoise image  
%   noise_region is the selected regions of interest and of background noise region
%   roi1,roi2,roi3,roi4 are four interest Regions
%   the function will return the result_cnr of the image  
%   tip: this function need five selected regions from the image you want to evaluate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%author:ebowtang
%author blog:http://blog.csdn.net/ebowtang
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
noise_region=double(noise_region);
roi1=double(roi1);
roi2=double(roi2);
roi3=double(roi3);
roi4=double(roi4);
 
ub=mean2(noise_region);
u1=mean2(roi1);
u2=mean2(roi2);
u3=mean2(roi3);
u4=mean2(roi4);
 
varb=std2(noise_region);varb=varb*varb;
var1=std2(roi1);var1=var1*var1;
var2=std2(roi2);var2=var2*var2;
var3=std2(roi1);var3=var3*var3;
var4=std2(roi1);var4=var4*var4;
 
cnr1=10*log((u1-ub)/sqrt(var1+varb));
cnr2=10*log((u2-ub)/sqrt(var2+varb));
cnr3=10*log((u3-ub)/sqrt(var3+varb));
cnr4=10*log((u4-ub)/sqrt(var4+varb));
 
result_cnr=(cnr1+cnr2+cnr3+cnr4)/4;

  

4,equivalent numbers of looks(ENL)等效視數

等效視數(ENL),這是一種衡量均勻區域的光滑性的指標(ENL is commonly used to measure the speckle suppression of different SAR/OCT image filters. When the ENL value is bigger, it indicates the image is smoothed well.)。一般我們可以選取幾個感興趣區域求取等效視數然後求平均,或者直接求取影象的等效視數。所以公式可以寫成如下:

公式中的分母表示感興趣區域的均值,分母則是方差

function result_enl = myEnl(img_roi)
%myEnl Summary of this function goes here  
%   img_roi is the selected regions from the your image(or the image )
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%author:ebowtang
%author blog:http://blog.csdn.net/ebowtang
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
img_roi=double(img_roi);
u1=mean2(img_roi);u1=u1*u1;
std1=std2(img_roi);var1=std1*std1;
result_enl=u1/var1;

  

5,edge preservation index(EPI)邊緣保持係數

ENL is commonly used to measure the speckle suppression of different SAR image filters. When the ENL value is bigger, it indicates the image is smoothed well.EPI measures the ability to maintain details of the image。

其表示式可以為,參考論文【5】:

參考程式碼為:

function result_epi=myEpi(img_before,img_after)
% 計算一副影象的邊緣保護指數EPI(Edge Protect Index),EPI越接近1,說明演算法的邊緣保持能力越強。
% img_before表示原始影象(這裡考慮標準影象,其他的話也可以考慮一下去噪前的影象,C實現的時候,考慮到平臺需求,用的是去噪前的影象)
% img_after表示去噪後的影象
% 根據《基於多小波域Besov球對映的SAR影象去噪演算法》
% 其他出處:《基於改進的小波軟閾值法的SAR影象去噪》
img_before=double(img_before);
img_after=double(img_after);
[height,width]=size(img_before);
sum1=0;
sum2=0;
%去噪前
for i=1:height   %水平
    for j=1:width-1
        sum1=sum1+abs(img_before(i,j)-img_before(i,j+1));
    end
end
for i=1:height-1  %垂直
    for j=1:width
        sum1=sum1+abs(img_before(i,j)-img_before(i+1,j));
    end
end
%去噪後
for i=1:height  %水平
    for j=1:width-1
        sum2=sum2+abs(img_after(i,j)-img_after(i,j+1));
    end
end
for i=1:height-1  %垂直
    for j=1:width
        sum2=sum2+abs(img_after(i,j)-img_after(i+1,j));
    end
end
sum1=double(sum1);
sum2=double(sum2);
result_epi=sum2/sum1;

  

參考資源:

【1】comparaison of snr image quality metrics for remote sensing systems[J]. Optical Engineering, 2001, 40(4):574-585

【2】點目標影象信噪比計算方法,王學偉, 王春歆, 張玉葉(海軍航空工程學院控制工程系,山東煙臺264001)

【3】一種遙感影象信噪比評估和度量準則,傅鵬,孫權森,紀則軒,陳強,南京理工大學電腦科學與工程學院,江蘇南京210094

【4】眼底OCT影象降噪及邊緣檢測演算法研究,劉濤;清華大學, 資訊與通訊工程, 2010, 碩士

【5】基於改進的小波軟閾值法的SAR 影象去噪,張微, 孫蓉樺, 章孝燦,(浙江大學空間資訊科技研究所, 浙江杭州310027

注:本博文為EbowTang原創,後續可能繼續更新本文。如果轉載,請務必複製本條資訊!

原文地址:http://blog.csdn.net/ebowtang/article/details/43643037

原作者部落格:http://blog.csdn.net/ebowtang