模型转化Mat-〉XML

原文:http://blog.youkuaiyun.com/loadstar_kun/article/details/8754883

第一步:获取参数

其中为matlab语言

1.components 个数

NumComponents= length(model.rules{model.start})

ncom =length(model.rules{model.start});

 2.Numberof features这个固定, = 31model文件中没有记录

 3.Score threshold= model.thresh

 第二步:获取每个component root 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

         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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值