Advertisement
Guest User

Untitled

a guest
Jun 8th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. namespace mlpack{
  2.  
  3. namespace structured_tree{
  4.  
  5. namespace details{
  6.  
  7. template <typename MatType = arma::mat, typename CubeType = arma::cube>
  8. class StructuredForestsImpl
  9. {
  10.  
  11. public:
  12. std::map<std::string, int> options;
  13.  
  14. StructuredForests(const std::map<std::string, int>& inMap);
  15.  
  16. MatType LoadData(MatType& images, MatType& boundaries,
  17. MatType& segmentations);
  18.  
  19. void PrepareData(MatType& InputData);
  20.  
  21. arma::vec GetFeatureDimension();
  22.  
  23. arma::vec dt_1d(arma::vec& f, int n);
  24.  
  25. void dt_2d(MatType& im);
  26.  
  27. MatType dt_image(MatType& im, double on);
  28.  
  29. arma::field<CubeType> GetFeatures(MatType& img,arma::umat& loc);
  30.  
  31. CubeType CopyMakeBorder(CubeType& InImage,
  32. int top, int left, int bottom, int right);
  33.  
  34. void GetShrunkChannels(CubeType& InImage, CubeType& reg_ch, CubeType& ss_ch);
  35.  
  36. CubeType RGB2LUV(CubeType& InImage);
  37.  
  38. MatType bilinearInterpolation(MatType const &src,
  39. size_t height, size_t width);
  40.  
  41. CubeType sepFilter2D(CubeType& InImage,
  42. arma::vec& kernel, int radius);
  43.  
  44. CubeType ConvTriangle(CubeType& InImage, int radius);
  45.  
  46. void Gradient(CubeType& InImage,
  47. MatType& Magnitude,
  48. MatType& Orientation);
  49.  
  50. MatType MaxAndLoc(CubeType& mag, arma::umat& Location);
  51.  
  52. CubeType Histogram(MatType& Magnitude,
  53. MatType& Orientation,
  54. int downscale, int interp);
  55.  
  56. CubeType ViewAsWindows(CubeType& channels, arma::umat& loc);
  57.  
  58. CubeType GetRegFtr(CubeType& channels, arma::umat& loc);
  59.  
  60. CubeType GetSSFtr(CubeType& channels, arma::umat& loc);
  61.  
  62. CubeType Rearrange(CubeType& channels);
  63.  
  64. CubeType PDist(CubeType& features, arma::uvec& grid_pos);
  65.  
  66. };
  67.  
  68. } //namespace details
  69.  
  70. template <typename MatType = arma::mat, typename CubeType = arma::cube>
  71. class StructuredForests
  72. {
  73.  
  74. public:
  75. StructuredForests(const std::map<std::string, int>& inMap);
  76.  
  77. MatType LoadData(MatType& images, MatType& boundaries,
  78. MatType& segmentations);
  79.  
  80. void PrepareData(MatType& InputData);
  81.  
  82. private:
  83. std::map<std::string, int> options;
  84.  
  85. arma::vec GetFeatureDimension();
  86.  
  87. arma::vec dt_1d(arma::vec& f, int n);
  88.  
  89. void dt_2d(MatType& im);
  90.  
  91. MatType dt_image(MatType& im, double on);
  92.  
  93. arma::field<CubeType> GetFeatures(MatType& img,arma::umat& loc);
  94.  
  95. CubeType CopyMakeBorder(CubeType& InImage,
  96. int top, int left, int bottom, int right);
  97.  
  98. void GetShrunkChannels(CubeType& InImage, CubeType& reg_ch, CubeType& ss_ch);
  99.  
  100. CubeType RGB2LUV(CubeType& InImage);
  101.  
  102. MatType bilinearInterpolation(MatType const &src,
  103. size_t height, size_t width);
  104.  
  105. CubeType sepFilter2D(CubeType& InImage,
  106. arma::vec& kernel, int radius);
  107.  
  108. CubeType ConvTriangle(CubeType& InImage, int radius);
  109.  
  110. void Gradient(CubeType& InImage,
  111. MatType& Magnitude,
  112. MatType& Orientation);
  113.  
  114. MatType MaxAndLoc(CubeType& mag, arma::umat& Location);
  115.  
  116. CubeType Histogram(MatType& Magnitude,
  117. MatType& Orientation,
  118. int downscale, int interp);
  119.  
  120. CubeType ViewAsWindows(CubeType& channels, arma::umat& loc);
  121.  
  122. CubeType GetRegFtr(CubeType& channels, arma::umat& loc);
  123.  
  124. CubeType GetSSFtr(CubeType& channels, arma::umat& loc);
  125.  
  126. CubeType Rearrange(CubeType& channels);
  127.  
  128. CubeType PDist(CubeType& features, arma::uvec& grid_pos);
  129.  
  130. };
  131.  
  132. }
  133.  
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement