pdfbflip_model.m
上传用户:l56789
上传日期:2022-02-25
资源大小:2422k
文件大小:2k
源码类别:

图形图像处理

开发平台:

Matlab

  1. % pdfbflip_model.m
  2. % By: Duncan Po
  3. % Date: December 5/2002
  4. % usage: newmodel = pdfbflip_model(model, level, subband)
  5. % input: model  -   model to be flipped
  6. %        level  -   the level where the flipping occurred
  7. %        subband-   the subband where the flipping occurred
  8. % output: newmodel  -   flipped model
  9. %
  10. % this function flip the state of a particular node (i.e. state 1
  11. % becomes state 2, and state 2 becomes state 1 for two state case)
  12. % This action doesn't change the model but can align the model against
  13. % another one which is useful in image retrieval, etc.
  14. function newmodel = pdfbflip_model(model, level, subband)
  15.  
  16. newmodel = model; 
  17. if level < length(model.stdv)
  18.     newmodel.stdv{level}{subband} = fliplr(newmodel.stdv{level}{subband});
  19.     
  20.     if strcmp(newmodel.zeromean, 'no') == 1
  21.         newmodel.mean{level}{subband} = fliplr(newmodel.mean{level}{subband});
  22.     end;
  23.     
  24.     if length(model.stdv{level}) == length(model.stdv{level+1})
  25.         newmodel.transprob{level}{subband} = ...
  26.             fliplr(newmodel.transprob{level}{subband});
  27.     else
  28.         % next level has double the directions
  29.         newmodel.transprob{level}{subband*2} = ...
  30.             fliplr(newmodel.transprob{level}{subband*2});
  31.         newmodel.transprob{level}{subband*2-1} = ...
  32.             fliplr(newmodel.transprob{level}{subband*2-1});
  33.     end;
  34.     if level ~= 1
  35.         newmodel.transprob{level-1}{subband} = ...
  36.             flipud(newmodel.transprob{level-1}{subband});
  37.     else
  38.         newmodel.rootprob = fliplr(newmodel.rootprob);
  39.     end;
  40. else
  41.     %level = finest level
  42.     newmodel.stdv{level}{subband} = fliplr(newmodel.stdv{level}{subband});
  43.     
  44.     if strcmp(newmodel.zeromean, 'no') == 1
  45.         newmodel.mean{level}{subband} = fliplr(newmodel.mean{level}{subband});
  46.     end;
  47.     
  48.     newmodel.transprob{level-1}{subband} = ...
  49.             flipud(newmodel.transprob{level-1}{subband});
  50. end;
  51.     
  52.