function [mu_prisparam cov_prisparam] = estimatemodelparam(folderpath,...
blocksizerow,blocksizecol,blockrowoverlap,blockcoloverlap,sh_th)
current = pwd;
cd(sprintf('%s',folderpath))
names = ls;
names = names(3:end,:);
cd(current)
% ---------------------------------------------------------------
%Number of features
% 18 features at each scale
featnum = 18;
% ---------------------------------------------------------------
% Make the directory for storing the features
mkdir(sprintf('local_risquee_prisfeatures'))
% ---------------------------------------------------------------
% Compute pristine image features
for itr = 1:size(names,1)
itr
im = imread(sprintf('%s\\%s',folderpath,names(itr,:)));
if(size(im,3)==3)
im = rgb2gray(im);
end
im = double(im);
[row col] = size(im);
block_rownum = floor(row/blocksizerow);
block_colnum = floor(col/blocksizecol);
im = im(1:block_rownum*blocksizerow, ...
1:block_colnum*blocksizecol);
window = fspecial('gaussian',7,7/6);
window = window/sum(sum(window));
scalenum = 2;
warning('off')
feat = [];
for itr_scale = 1:scalenum
mu = imfilter(im,window,'replicate');
mu_sq = mu.*mu;
sigma = sqrt(abs(imfilter(im.*im,window,'replicate') - mu_sq));
structdis = (im-mu)./(sigma+1);
feat_scale = blkproc(structdis,[blocksizerow/itr_scale blocksizecol/itr_scale], ...
[blockrowoverlap/itr_scale blockcoloverlap/itr_scale], ...
@computefeature);
feat_scale = reshape(feat_scale,[featnum ....
size(feat_scale,1)*size(feat_scale,2)/featnum]);
feat_scale = feat_scale';
if(itr_scale == 1)
sharpness = blkproc(sigma,[blocksizerow blocksizecol], ...
[blockrowoverlap blockcoloverlap],@computemean);
sharpness = sharpness(:);
end
feat = [feat feat_scale];
im =imresize(im,0.5);
end
save(sprintf('local_risquee_prisfeatures\\prisfeatures_local%d.mat',...
itr),'feat','sharpness');
end
%----------------------------------------------
% Load pristine image features
prisparam = [];
current = pwd;
cd(sprintf('%s','local_risquee_prisfeatures'))
names = ls;
names = names(3:end,:);
cd(current)
for itr = 1:size(names,1)
% Load the features and select the only features
load(sprintf('local_risquee_prisfeatures\\%s',strtrim(names(itr,:))));
IX = find(sharpness(:) >sh_th*max(sharpness(:)));
feat = feat(IX,:);
prisparam = [prisparam; feat];
end
%----------------------------------------------
% Compute model parameters
mu_prisparam = nanmean(prisparam);
cov_prisparam = nancov(prisparam);
%----------------------------------------------
% Save features in the mat file
save('modelparameters_new.mat','mu_prisparam','cov_prisparam');
%----------------------------------------------
fpga和matlab
- 粉丝: 17w+
- 资源: 2637
最新资源
- 基于Springboot的网上商城购物系统实现源码+数据库+文档(高分期末大作业)
- (25638822)图书馆管理系统(Servlet+Java+Jsp+Mysql)
- (22559438)基于stm32、0.96寸OLED实现的贪吃蛇小游戏(详细源码注释)
- 机械设计LOGO检测机彩盒CCD检测设备sw18可编辑非常好的设计图纸100%好用.zip
- 基于Pyotrch开发的深度学习物体分类系统(图形化界面)高分项目源码
- Java毕设-基于Springboot的网上商城购物系统实现源码+数据库+文档
- intrinsics.h
- (173873224)05 AUTOSAR行业汽车工程师资料
- 基于S7-200 PLC和组态王大小球大小分拣
- (179461246)MATLAB代码:电-气-热综合能源系统耦合优化调度 关键词:综合能源系统 优化调度 电气热耦合 仿真平台:MATLAB Y
- Kinect v2 Examples with MS-SDK 2.23
- (177300606)软件工程:概要设计说明书
- (177196812)VBA实现合并相同单元格
- (174331414)VBA实现格式相同的excel文件汇总合并
- 封装 axios 拦截器实现用户无感刷新 access-token
- 燃料电池仿真模型燃料电池仿真模型,本模型基于Cruise软件和 Simulink软件共同搭建完成,并基于实际项目搭建,本资料包包含所有源文件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
前往页