%%SAR 图像处理---参数统计模型
%reference--课件
%author:huangzhijian
%2010-5-7
I = imread('E:\博士作业\SAR图像处理\灌木1.jpg');
%直方图统计
[row,col]=size(I(:,:,1));
data = zeros(row*col,1);
for i=1:row
for j=1:col
data(j+(i-1)*col) = double (I(i,j,1))+0.00001; %避免出现像素值为0的情况
end
end
X = 0:1:255;
histPdf=histc(data,X)/(row*col); %只使用R通道的分量进行统计
histPdf = histPdf';
histCdf = cumsum(histPdf);
plot(X,histPdf,'-cp','MarkerSize',2);
axis([0 150 0 0.03]);
hold on;
% plot(X,histCdf,'-rp','MarkerSize',2);
% %选用Rayleigh为统计模型,进行参数估计
varRayl = raylfit(data);
raylPdf = raylpdf(X,varRayl);
raylCdf = raylcdf(X,varRayl);
plot(X,raylPdf,'--ro','MarkerSize',2);
hold on;
%选用weibull分布为统计模型,进行参数估计
parmhat = wblfit(data);
wblPdf = wblpdf(X,parmhat(1),parmhat(2));
wblCdf = wblcdf(X,parmhat(1),parmhat(2));
plot(X,wblPdf,'--g*','MarkerSize',2);
hold on;
%选用gamma分布为统计模型,进行参数估计
parmGam = gamfit(data);
gamPDF = gampdf(X,parmGam(1),parmGam(2));
gamCdf = gamcdf(X,parmGam(1),parmGam(2));
plot(X,gamPDF,'--bs','MarkerSize',2);hold on;
%选用log normal分布为统计模型,进行参数估计
parmLogn = lognfit(data);
lognPDF = lognpdf(X,parmLogn(1),parmLogn(2));
lognCdf = logncdf(X,parmLogn(1),parmLogn(2));
plot(X,lognPDF,':md','MarkerSize',2);
h = legend('直方图','rayl','weibul','gama','lognorm',5);
set(h,'Interpreter','none');
%ks准则
%两个CDF幅值差的上确界,该值越小说明拟合程度越好
pR = max(abs(minus(histCdf,raylCdf)));
pW = max(abs(minus(histCdf,wblCdf)));
pG = max(abs(minus(histCdf,gamCdf)));
pL = max(abs(minus(histCdf,lognCdf)));
ksk = [pR,pW,pG,pL];
%chi-squre准则
%两PDF幅值的差方和,并与取相对值,该值越小说明拟合程度越好
PR = chi2test(histPdf,raylPdf);
PW = chi2test(histPdf,wblPdf);
PG = chi2test(histPdf,gamPDF);
PL = chi2test(histPdf,lognPDF);
chiP = [PR,PW,PG,PL];
%绝对值误差检验准则
absRayl = sum(abs(histPdf-raylPdf));
abswbl = sum(abs(histPdf-wblPdf));
absgama = sum(abs(histPdf-gamPDF));
abslogn = sum(abs(histPdf-lognPDF));
absR = [absRayl,abswbl,absgama,abslogn];
%偏度系数
%期望的偏离程度,自己定义
exHist=EX(histPdf);
skwR = [abs(EX(raylPdf)-exHist),abs(EX(wblPdf)-exHist),abs(EX(gamPDF)-exHist),abs(EX(lognPDF)-exHist)];
%峰度系数
kurtosisR = [kurtosis(raylPdf),kurtosis(wblPdf),kurtosis(gamPDF),kurtosis(lognPDF)];
figure ;
Xcor = 1:4;
plot(Xcor,ksk,'-ro'); hold on;
plot(Xcor,chiP,'--bs'); hold on;
plot(Xcor,absR,'-.g*'); hold on;
plot(Xcor,skwR,':rd'); hold on;
plot(Xcor,kurtosisR,'-.cd'); hold on;
axis([1 4 -0.1 1]);
state = {'rayl','','weibul','','gama','','lognorm'};
set(gca,'xticklabel',state,'FontSize',12);
h = legend('K-S','chi-square','ABS','偏度','gh',5);
set(h,'Interpreter','none');
result=[varRayl,parmhat(1),parmhat(2),parmGam(1),parmGam(2),parmLogn(1),parmLogn(2)];
柳依刺猬
- 粉丝: 3
- 资源: 2
最新资源
- 海康摄像头ActiveX控件是专为视频监控设备,只需设置摄像头用户名,密码,IP,端口即可
- 我的nvim的init.lua配置
- 最新操作系统试题及答案
- 毕业设计,基于Python+Django+Vue+MySql开发前后端分离的社团管理系统,含源码,数据库,毕业论文,视频教程
- 社团管理系统-毕业设计,基于Python+Django+Vue+MySql开发,前后端分离,源码+数据库+毕业论文+视频演示
- 钻模板工艺设计及数控编程.docx
- 综合物流电子商务平台建设项目可行性研究报告.doc
- 总体设计教案稿软件工程精美解析.ppt
- 最全计算机网络期末考试试题及答案.doc
- 基于MATLAB软件和DNN深度神经网络的MNIST数据集手写字符识别源代码
- 精选毕设项目-51报名管家小程序.zip
- 精选毕设项目-3C手机商城小程序.zip
- 精选毕设项目- 班夫旅游小程序.zip
- 精选毕设项目-cncode论坛.zip
- 精选毕设项目-Bookshare 借书小程序.zip
- 精选毕设项目-IT公司.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
前往页