|
楼主 |
发表于 2007-7-14 15:32
|
显示全部楼层
OK我放弃了哪个,重新写了这个,没错了哦:victory:
%第一步:在Matlab中进行统计建模并计算出均值m和协方差n
f1=imread('01.bmp');
f1_ycbcr=rgb2ycbcr(f1);
f1_ycbcr=double(f1_ycbcr);
fcb1=f1_ycbcr(:,:,2);
fcr1=f1_ycbcr(:,:,3);
[m1 n1 r1]=size(f1_ycbcr);
cb1=reshape(fcb1,1,m1*n1);
cr1=reshape(fcr1,1,m1*n1);
f2=imread('02.bmp');
f2_ycbcr=rgb2ycbcr(f2);
f2_ycbcr=double(f2_ycbcr);
fcb2=f2_ycbcr(:,:,2);
fcr2=f2_ycbcr(:,:,3);
[m2 n2 r2]=size(f2_ycbcr);
cb2=reshape(fcb2,1,m2*n2);
cr2=reshape(fcr2,1,m2*n2);
f3=imread('03.bmp');
f3_ycbcr=rgb2ycbcr(f3);
f3_ycbcr=double(f3_ycbcr);
fcb3=f3_ycbcr(:,:,2);
fcr3=f3_ycbcr(:,:,3);
[m3 n3 r3]=size(f3_ycbcr);
cb3=reshape(fcb3,1,m3*n3);
cr3=reshape(fcr3,1,m3*n3);
f4=imread('04.bmp');
f4_ycbcr=rgb2ycbcr(f4);
f4_ycbcr=double(f4_ycbcr);
fcb4=f4_ycbcr(:,:,2);
fcr4=f4_ycbcr(:,:,3);
[m4 n4 r4]=size(f4_ycbcr);
cb4=reshape(fcb4,1,m4*n4);
cr4=reshape(fcr4,1,m4*n4);
f5=imread('05.bmp');
f5_ycbcr=rgb2ycbcr(f5);
f5_ycbcr=double(f5_ycbcr);
fcb5=f5_ycbcr(:,:,2);
fcr5=f5_ycbcr(:,:,3);
[m5 n5 r5]=size(f5_ycbcr);
cb5=reshape(fcb5,1,m5*n5);
cr5=reshape(fcr5,1,m5*n5);
cb=cat(2,cb1,cb2,cb3,cb4,cb5);
cr=cat(2,cr1,cr2,cr3,cr4,cr5);
h=mean2(cb);
k=mean2(cr);
m=[h,k]
n=cov(cb,cr)
已经在使用中了
谢谢老8了哦 |
|