数字图像处理matlab,给下面这段代码加注释rgb=imread('1.jpg'); rgb1=double(rgb);r=rgb1(:,:,1); g=rgb1(:,:,2); b=rgb1(:,:,3);[m,n]=size(r);er=mean(mean(r(:)))dr1=0.0;sr1=0.0;for i=1:mfor j=1:ndr1=dr1+(r(i,j)-er)^2;sr1=sr1+(r(i,j)-er)^3;en
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/28 00:23:16
数字图像处理matlab,给下面这段代码加注释rgb=imread('1.jpg'); rgb1=double(rgb);r=rgb1(:,:,1); g=rgb1(:,:,2); b=rgb1(:,:,3);[m,n]=size(r);er=mean(mean(r(:)))dr1=0.0;sr1=0.0;for i=1:mfor j=1:ndr1=dr1+(r(i,j)-er)^2;sr1=sr1+(r(i,j)-er)^3;en
数字图像处理matlab,给下面这段代码加注释
rgb=imread('1.jpg');
rgb1=double(rgb);
r=rgb1(:,:,1);
g=rgb1(:,:,2);
b=rgb1(:,:,3);
[m,n]=size(r);
er=mean(mean(r(:)))
dr1=0.0;sr1=0.0;
for i=1:m
for j=1:n
dr1=dr1+(r(i,j)-er)^2;
sr1=sr1+(r(i,j)-er)^3;
end
end
dr=sqrt(dr1/(m*n))
sr=(sr1/(m*n))^0.3333
eg=mean(mean(g(:)))
dg1=0.0;sg1=0.0;
for i=1:m
for j=1:n
dg1=dg1+(g(i,j)-eg)^2;
sg1=sg1+(g(i,j)-eg)^3;
end
end
dg=sqrt(dg1/(m*n))
sg=(sg1/(m*n))^0.3333
eb=mean(mean(b(:)))
db1=0.0;sb1=0.0;
for i=1:m
for j=1:n
db1=db1+(b(i,j)-eb)^2;
sb1=sb1+(b(i,j)-eb)^3;
end
end
db=sqrt(db1/(m*n))
sb=(sb1/(m*n))^0.3333
数字图像处理matlab,给下面这段代码加注释rgb=imread('1.jpg'); rgb1=double(rgb);r=rgb1(:,:,1); g=rgb1(:,:,2); b=rgb1(:,:,3);[m,n]=size(r);er=mean(mean(r(:)))dr1=0.0;sr1=0.0;for i=1:mfor j=1:ndr1=dr1+(r(i,j)-er)^2;sr1=sr1+(r(i,j)-er)^3;en
rgb=imread('1.jpg'); %读取rgb图 1.jpg
rgb1=double(rgb); %图像矩阵的数据类型转换为double类型
r=rgb1(:,:,1); %矩阵r存储rgb图中r通道的二维矩阵
g=rgb1(:,:,2); %矩阵g存储rgb图中g通道的二维矩阵
b=rgb1(:,:,3); %矩阵b存储rgb图中b通道的二维矩阵
[m,n]=size(r); %m为矩阵r的行数,n为矩阵r的列数
er=mean(mean(r(:))) %er为矩阵r所有元素的均值
dr1=0.0;sr1=0.0; %令dr1的初始值为0.0,令sr1的初始值为0.0
for i=1:m %外循环
for j=1:n %内循环
dr1=dr1+(r(i,j)-er)^2; %将矩阵r中每个像素值减去所有像素均值的平方值累加到变量dr1;
sr1=sr1+(r(i,j)-er)^3; %将矩阵r中每个像素值减去所有像素均值的三次方值累加到变量sr1;
end
end
dr=sqrt(dr1/(m*n)) %dr1除以矩阵r的大小m*n,然后开平方的值赋值给dr
sr=(sr1/(m*n))^0.3333 %sr1除以矩阵r的大小m*n,然后开三次方的值赋值给sr
eg=mean(mean(g(:))) %该处为矩阵g的处理,与上面矩阵r的方法和步骤一样
dg1=0.0;sg1=0.0;
for i=1:m
for j=1:n
dg1=dg1+(g(i,j)-eg)^2;
sg1=sg1+(g(i,j)-eg)^3;
end
end
dg=sqrt(dg1/(m*n))
sg=(sg1/(m*n))^0.3333
eb=mean(mean(b(:))) %该处为矩阵b的处理,与上面矩阵r的方法和步骤一样
db1=0.0;sb1=0.0;
for i=1:m
for j=1:n
db1=db1+(b(i,j)-eb)^2;
sb1=sb1+(b(i,j)-eb)^3;
end
end
db=sqrt(db1/(m*n))
sb=(sb1/(m*n))^0.3333
有什么问题可以继续讨论,