PageRenderTime 58ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/GML_AdaBoost_Matlab_Toolbox_0.3/@tree_node_w/get_dim_and_tr.m

http://cvfootballtracking.googlecode.com/
Objective C | 60 lines | 54 code | 6 blank | 0 comment | 5 complexity | e67dafc1e21d5f1a7a550130a01d5a0c MD5 | raw file
  1. % The algorithms implemented by Alexander Vezhnevets aka Vezhnick
  2. % <a>href="mailto:vezhnick@gmail.com">vezhnick@gmail.com</a>
  3. %
  4. % Copyright (C) 2005, Vezhnevets Alexander
  5. % vezhnick@gmail.com
  6. %
  7. % This file is part of GML Matlab Toolbox
  8. % For conditions of distribution and use, see the accompanying License.txt file.
  9. %
  10. % get_dim_and_tr is the function, that returns dimension and threshold of
  11. % tree node
  12. %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  13. %
  14. % output = get_dim_and_tr(tree_node, output)
  15. % ---------------------------------------------------------------------------------
  16. % Arguments:
  17. % tree_node - a node of classification tree
  18. % output - vector of dimensions and thresholds. Result fo
  19. % current node would be concatinated to it
  20. % Return:
  21. % output - a vector of thresholds and dimensions. It has the
  22. % following format:
  23. % [dimension threshold left/right ...]
  24. % left/right is [-1, +1] number, wich signifies if
  25. % current threshold is eather left or right
  26. function output = get_dim_and_tr(tree_node, output)
  27. if(nargin < 2)
  28. output = [];
  29. end
  30. if(length(tree_node.parent) > 0)
  31. output = get_dim_and_tr(tree_node.parent, output);
  32. end
  33. output(end+1) = tree_node.dim;
  34. if( length(tree_node.right_constrain) > 0)
  35. output(end+1) = tree_node.right_constrain;
  36. output(end+1) = -1;
  37. elseif( length(tree_node.left_constrain) > 0)
  38. output(end+1) = tree_node.left_constrain;
  39. output(end+1) = +1;
  40. end
  41. % function [dim, tr, signum] = get_dim_and_tr(tree_node)
  42. %
  43. % dim = tree_node.dim;
  44. %
  45. %
  46. %
  47. % if( length(tree_node.right_constrain) > 0)
  48. % tr = tree_node.right_constrain;
  49. % signum = -1;
  50. % end
  51. % if( length(tree_node.left_constrain) > 0)
  52. % tr = tree_node.left_constrain;
  53. % signum = +1;
  54. % end