原文:http://www.jb51.cc/article/p-fietxyka-bcb.html
第一步:获取参数
其中为matlab语言
1.components个数
NumComponents= length(model.rules{model.start})
ncom =length(model.rules{model.start});
2.Numberof features这个固定,= 31,model文件中没有记录
3.score threshold= model.thresh
第二步:获取每个component的root filter,part filters,deformation filter
1.对于每个component首先获取其中rootfilter的索引
由model.start获取root filter的标号,分两种情况:
for icom = 1:ncom %component个数
rhs =model.rules{model.start}(icom).rhs;
% assume the root filter is firston the rhs of the start rules
if model.symbols(rhs(1)).type =='T'
% handle case where there's nodeformation model for the root
root =model.symbols(rhs(1)).filter;
else
% handle case where there is adeformation model for the root
root =model.symbols(model.rules{rhs(1)}(layer).rhs).filter;
end
2.在每个component内,获取part filter的个数,并获取每个part的参数
icom =1:NumComponents
npart =length(model.rules{model.start}(icom).rhs) -1 ;
%icom取值不同不影响这个结果,应该不同的part值一样
for ipart= 2: npart+1
irule =model.rules{model.start}(icom).rhs(ipart);
filternum =model.symbols(model.rules{irule}.rhs).filter;
%获取每个part的相关参数[dx,dy,ds]和penalty[dx dy dxx dyy]
Vx =model.rules{model.start}(icom).anchor{ipart}(1)+1;
Vy =model.rules{model.start}(icom).anchor{ipart}(2)+1;
dx = model.rules{irule}.def.w(2);
dy = model.rules{irule}.def.w(4);
dxx = model.rules{irule}.def.w(1);
dyy = model.rules{irule}.def.w(3);
end