⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dimage_independencetest.m

📁 包括相邻帧差分结果的高斯性和独立性检验实验结果演示程序。
💻 M
字号:
clear;
clc;

%读入连续四帧图像
im1=double(imread('img1.bmp'));
im2=double(imread('img2.bmp'));
im3=double(imread('img3.bmp'));
im4=double(imread('img4.bmp'));

[ny,nx]=size(im1);

%对相邻帧进行差分运算
yn=(im2-im1);

%从残留图像中选取大小为100*100的像素块
yn=yn((ny/2):(ny/2+99),(nx/2):(nx/2+99));

%计算Friedman统计量及概率alpha
[p,table,stats]=friedman(yn(1:100,1:100),1,'off');
s(1)=table(2,5);
a(1)=table(2,6);
[p,table,stats]=friedman(yn(1:50,1:100),1,'off');
s(2)=table(2,5);
a(2)=table(2,6);
[p,table,stats]=friedman(yn(51:100,1:100),1,'off');
s(3)=table(2,5);
a(3)=table(2,6);
[p,table,stats]=friedman(yn(26:75,1:100),1,'off');
s(4)=table(2,5);
a(4)=table(2,6);
[p,table,stats]=friedman(yn(1:30,1:100),1,'off');
s(5)=table(2,5);
a(5)=table(2,6);
[p,table,stats]=friedman(yn(31:60,1:100),1,'off');
s(6)=table(2,5);
a(6)=table(2,6);
[p,table,stats]=friedman(yn(61:90,1:100),1,'off');
s(7)=table(2,5);
a(7)=table(2,6);
[p,table,stats]=friedman(yn(1:20,1:100),1,'off');
s(8)=table(2,5);
a(8)=table(2,6);
[p,table,stats]=friedman(yn(21:60,1:100),1,'off');
s(9)=table(2,5);
a(9)=table(2,6);
[p,table,stats]=friedman(yn(71:90,1:100),1,'off');
s(10)=table(2,5);
a(10)=table(2,6);

%对相邻帧进行差分运算
yn=(im3-im2);

%从残留图像中选取大小为100*100的像素块
yn=yn((ny/2):(ny/2+99),(nx/2):(nx/2+99));

%计算Friedman统计量及概率alpha
[p,table,stats]=friedman(yn(1:100,1:100),1,'off');
s2(1)=table(2,5);
a2(1)=table(2,6);
[p,table,stats]=friedman(yn(1:50,1:100),1,'off');
s2(2)=table(2,5);
a2(2)=table(2,6);
[p,table,stats]=friedman(yn(51:100,1:100),1,'off');
s2(3)=table(2,5);
a2(3)=table(2,6);
[p,table,stats]=friedman(yn(26:75,1:100),1,'off');
s2(4)=table(2,5);
a2(4)=table(2,6);
[p,table,stats]=friedman(yn(1:30,1:100),1,'off');
s2(5)=table(2,5);
a2(5)=table(2,6);
[p,table,stats]=friedman(yn(31:60,1:100),1,'off');
s2(6)=table(2,5);
a2(6)=table(2,6);
[p,table,stats]=friedman(yn(61:90,1:100),1,'off');
s2(7)=table(2,5);
a2(7)=table(2,6);
[p,table,stats]=friedman(yn(1:20,1:100),1,'off');
s2(8)=table(2,5);
a2(8)=table(2,6);
[p,table,stats]=friedman(yn(21:60,1:100),1,'off');
s2(9)=table(2,5);
a2(9)=table(2,6);
[p,table,stats]=friedman(yn(71:90,1:100),1,'off');
s2(10)=table(2,5);
a2(10)=table(2,6);

%对相邻帧进行差分运算
yn=(im4-im3);
%从残留图像中选取大小为100*100的像素块
yn=yn((ny/2):(ny/2+99),(nx/2):(nx/2+99));

%计算Friedman统计量及概率alpha
[p,table,stats]=friedman(yn(1:100,1:100),1,'off');
s3(1)=table(2,5);
a3(1)=table(2,6);
[p,table,stats]=friedman(yn(1:50,1:100),1,'off');
s3(2)=table(2,5);
a3(2)=table(2,6);
[p,table,stats]=friedman(yn(51:100,1:100),1,'off');
s3(3)=table(2,5);
a3(3)=table(2,6);
[p,table,stats]=friedman(yn(26:75,1:100),1,'off');
s3(4)=table(2,5);
a3(4)=table(2,6);
[p,table,stats]=friedman(yn(1:30,1:100),1,'off');
s3(5)=table(2,5);
a3(5)=table(2,6);
[p,table,stats]=friedman(yn(31:60,1:100),1,'off');
s3(6)=table(2,5);
a3(6)=table(2,6);
[p,table,stats]=friedman(yn(61:90,1:100),1,'off');
s3(7)=table(2,5);
a3(7)=table(2,6);
[p,table,stats]=friedman(yn(1:20,1:100),1,'off');
s3(8)=table(2,5);
a3(8)=table(2,6);
[p,table,stats]=friedman(yn(21:60,1:100),1,'off');
s3(9)=table(2,5);
a3(9)=table(2,6);
[p,table,stats]=friedman(yn(71:90,1:100),1,'off');
s3(10)=table(2,5);
a3(10)=table(2,6);

%对高斯白噪声计算Friedman统计量及概率alpha,与上述结果进行比较

yn=randn(100,100);
[p,table,stats]=friedman(yn(1:100,1:100),1,'off');
sn(1)=table(2,5);
an(1)=table(2,6);
[p,table,stats]=friedman(yn(1:50,1:100),1,'off');
sn(2)=table(2,5);
an(2)=table(2,6);
[p,table,stats]=friedman(yn(51:100,1:100),1,'off');
sn(3)=table(2,5);
an(3)=table(2,6);
[p,table,stats]=friedman(yn(26:75,1:100),1,'off');
sn(4)=table(2,5);
an(4)=table(2,6);
[p,table,stats]=friedman(yn(1:30,1:100),1,'off');
sn(5)=table(2,5);
an(5)=table(2,6);
[p,table,stats]=friedman(yn(31:60,1:100),1,'off');
sn(6)=table(2,5);
an(6)=table(2,6);
[p,table,stats]=friedman(yn(61:90,1:100),1,'off');
sn(7)=table(2,5);
an(7)=table(2,6);
[p,table,stats]=friedman(yn(1:20,1:100),1,'off');
sn(8)=table(2,5);
an(8)=table(2,6);
[p,table,stats]=friedman(yn(21:60,1:100),1,'off');
sn(9)=table(2,5);
an(9)=table(2,6);
[p,table,stats]=friedman(yn(71:90,1:100),1,'off');
sn(10)=table(2,5);
an(10)=table(2,6);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -