模型转化Mat-〉XML

前端之家收集整理的这篇文章主要介绍了模型转化Mat-〉XML前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

原文: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这个固定,= 31model文件中没有记录

3.score threshold= model.thresh

第二步:获取每个componentroot filterpart filtersdeformation 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

猜你在找的XML相关文章