Object Recognition and Scene Understanding(九)模型轉化Mat-〉XML

第一步:獲取參數

其中爲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

發佈了45 篇原創文章 · 獲贊 30 · 訪問量 63萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章