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

图形图像处理

开发平台:

Matlab

  1. % pdfbtrainimagethmt.m
  2. % written by: Duncan Po
  3. % Date: August 24, 2002
  4. % Using the EM algorithm, train models for the specified image
  5. % Usage: [model, stateprob] = pdfbtrainimagethmt(imname, imformat, initmodel, mD)
  6. % Inputs:   imname      - name of the image file
  7. %           imformat    - format of the image file (e.g. 'gif')
  8. %           initmodel   - optional. Give an intial model to speed up the training
  9. %                         process. Input '' if not providing initial model.
  10. %           mD          - convergence value
  11. % Output:   model       - the model generated
  12. %           stateprob   - state probabilities
  13. function [model, stateprob] = pdfbtrainimagethmt(imname, imformat, initmodel, mD)
  14. pyrfilter = '9-7';
  15. dirfilter = 'pkva';
  16. levndir = [2 2 3 3];
  17. ns = 2;
  18. zeromean = 'yes';
  19. coef = contourlet(pyrfilter, dirfilter, levndir, imname, imformat);
  20. for dir = 1:2.^levndir(1)
  21.     [tree, scaling] = contourlet2tree(coef, dir);
  22.     if isempty(initmodel)
  23.         [tempmodel, tempstateprob] = pdfbtrainthmt(tree, levndir, mD, ns,zeromean);
  24.     else
  25.         [tempmodel, tempstateprob] = pdfbtrainthmt(tree, levndir, mD,...
  26.             initmodel{dir});
  27.     end;
  28.     model{dir} = tempmodel;
  29.     stateprob{dir} = tempstateprob;
  30. end;