资源简介

程序基于“Fast and reliable structure-oriented video noise estimation”并做了改进,分为针对CFA图像、灰度图像、RGB三个版本,各子通道方差综合方法可以修正,程序留出了第三个可选参数用于扩展。程序实现上可进一步优化以提高处理速度(比如记录K个最小值中的最大值位置等),感兴趣的朋友可以自己动手改动。

资源截图

代码片段和文件信息

function sigma=CFANoiseEstimation(CFANwindowsizeKmethod)
if ~exist(‘method‘‘var‘)
    method=1;
end
if ~exist(‘K‘‘var‘)
    K=50;
end
if ~exist(‘windowsize‘‘var‘)
    windowsize=5;

end
if windowsize==5
    load(‘f5x5.mat‘)
else
    windowsize=3;
    load(‘f3x3.mat‘)
end
width=size(CFAN2);
height=size(CFAN1);
radius=floor(windowsize/2);

%% 计算通道1方差
minMeasValArr=2000+(1:K);
varArr=9*255^2+(1:K);
for i=2*radius+1:2:height-2*radius-1
    for j=2*radius+1:2:width-2*radius-1
        block=CFAN(i-2*radius:2:i+2*radiusj-2*radius:2:j+2*radius);
        if min(block(:))==0 || max(block(:))==255
            continue;
        end
        measVal1=abs(sum(sum(block.*f1)));
        measVal2=abs(sum(sum(block.*f2)));
        measVal3=abs(sum(sum(block.*f3)));
        measVal4=abs(sum(sum(block.*f4)));
        measVal5=abs(sum(sum(block.*f5)));
        measVal6=abs(sum(sum(block.*f6)));
        measVal7=abs(sum(sum(block.*f7)));
        measVal8=abs(sum(sum(block.*f8)));
        totalMeasVal=measVal1+measVal2+measVal3+measVal4+measVal5+measVal6+measVal7+measVal8;
        maxValofKMins=max(minMeasValArr);
        if totalMeasVal            index=find(minMeasValArr==maxValofKMins);
            minMeasValArr(index(1))=totalMeasVal;
            varBlock=var(block(:));
            varArr(index(1))=varBlock;
        end
    end
end
min3vals=mink(minMeasValArr3);
index1=find(minMeasValArr==min3vals(1));
index2=find(minMeasValArr==min3vals(2));
index3=find(minMeasValArr==min3vals(3));
index=[index1index2index3];
var1=varArr(index(1));
var2=varArr(index(2));
var3=varArr(index(3));
medianVar=median([var1var2var3]);
refPSNR=10*log10(255^2/(medianVar+0.0001));
sumVar=0;
num=0;
for i=1:K
    psnr=10*log10(255^2/(varArr(i)+0.0001));
    if abs(psnr-refPSNR)<3
        num=num+1;
        sumVar=sumVar+varArr(i);
    end
end
var11=sumVar/num;
%% 计算通道2方差
minMeasValArr=2000+(1:K);
varArr=9*255^2+(1:K);
for i=2*radius+1:2:height-2*radius-1
    for j=2*radius+2:2:width-2*radius
        block=CFAN(i-2*radius:2:i+2*radiusj-2*radius:2:j+2*radius);
        if min(block(:))==0 || max(block(:))==255
            continue;
        end
        measVal1=abs(sum(sum(block.*f1)));
        measVal2=abs(sum(sum(block.*f2)));
        measVal3=abs(sum(sum(block.*f3)));
        measVal4=abs(sum(sum(block.*f4)));
        measVal5=abs(sum(sum(block.*f5)));
        measVal6=abs(sum(sum(block.*f6)));
        measVal7=abs(sum(sum(block.*f7)));
        measVal8=abs(sum(sum(block.*f8)));
        totalMeasVal=measVal1+measVal2+measVal3+measVal4+measVal5+measVal6+measVal7+measVal8;
        maxValofKMins=max(minMeasValArr);
        if totalMeasVal            index=find(minMeasValArr==maxValofKMins);
            minMeasValArr(index(1))=totalMeasVal;
            varBlock=var(block(:));
            varArr(index(

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       6876  2020-06-15 15:47  噪声估计\CFANoiseEstimation.m

     文件        551  2020-06-15 10:09  噪声估计\f3x3.mat

     文件        600  2020-06-15 10:08  噪声估计\f5x5.mat

     文件       1935  2020-06-15 15:47  噪声估计\NoiseEstimation.m

     文件       5261  2020-06-15 16:21  噪声估计\NoiseEstimationRGB.m

     目录          0  2020-06-16 15:34  噪声估计

----------- ---------  ---------- -----  ----

                15223                    6


评论

共有 条评论