initWorkspaceWHOGeneric.m 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. function initWorkspaceWHOGeneric
  2. %% setup paths in use-specific manner
  3. if strcmp( getenv('USER'), 'freytag')
  4. % dependencies go here
  5. else
  6. fprintf('Unknown user %s and unknown default settings', getenv('USER') );
  7. end
  8. %% add paths
  9. % add main path
  10. b_recursive = false;
  11. b_overwrite = true;
  12. s_pathMain = fullfile(pwd);
  13. addPathSafely ( s_pathMain, b_recursive, b_overwrite )
  14. clear ( 's_pathMain' );
  15. % pre-computed data
  16. b_recursive = true;
  17. b_overwrite = true;
  18. s_pathData = fullfile(pwd, 'data');
  19. addPathSafely ( s_pathData, b_recursive, b_overwrite )
  20. clear ( 's_pathData' );
  21. % things for detecting objects
  22. b_recursive = true;
  23. b_overwrite = true;
  24. s_pathDetect = fullfile(pwd, 'detect');
  25. addPathSafely ( s_pathDetect, b_recursive, b_overwrite )
  26. clear ( 's_pathDetect' );
  27. % mainly HOG and scripts for image resizing
  28. b_recursive = true;
  29. b_overwrite = true;
  30. s_pathFeatures = fullfile(pwd, 'features');
  31. addPathSafely ( s_pathFeatures, b_recursive, b_overwrite )
  32. clear ( 's_pathFeatures' );
  33. % everything regarding learning the actual LDA detectors
  34. b_recursive = true;
  35. b_overwrite = true;
  36. s_pathLearn = fullfile(pwd, 'learn');
  37. addPathSafely ( s_pathLearn, b_recursive, b_overwrite )
  38. clear ( 's_pathLearn' );
  39. % path to introducing demo scripts
  40. b_recursive = true;
  41. b_overwrite = true;
  42. s_pathDemos = fullfile(pwd, 'demos');
  43. addPathSafely ( s_pathDemos, b_recursive, b_overwrite )
  44. clear ( 's_pathDemos' );
  45. % minor things, e.g., warping of blocks or padding of arrays
  46. b_recursive = false;
  47. b_overwrite = true;
  48. s_pathMisc = fullfile(pwd, 'misc');
  49. addPathSafely ( s_pathMisc, b_recursive, b_overwrite )
  50. clear ( 's_pathMisc' );
  51. % read images from given filename
  52. if (exist('readImage') ~= 2 )
  53. b_recursive = true;
  54. b_overwrite = true;
  55. s_pathImageIO = fullfile(pwd, 'misc/imageIO');
  56. addPathSafely ( s_pathImageIO, b_recursive, b_overwrite )
  57. clear ( 's_pathImageIO' );
  58. end
  59. % scripts for configuration of setting-objects
  60. if (exist('getFieldWithDefault') ~= 2 )
  61. b_recursive = true;
  62. b_overwrite = true;
  63. s_pathSettings = fullfile(pwd, 'misc/settings');
  64. addPathSafely ( s_pathSettings, b_recursive, b_overwrite )
  65. clear ( 's_pathSettings' );
  66. end
  67. %% 3rd party, untouched
  68. % nothing needed here...
  69. end
  70. function addPathSafely ( s_path, b_recursive, b_overwrite )
  71. if ( ~isempty(strfind(path, [s_path , pathsep])) )
  72. if ( b_overwrite )
  73. if ( b_recursive )
  74. rmpath( genpath( s_path ) );
  75. else
  76. rmpath( s_path );
  77. end
  78. else
  79. fprintf('InitPatchDiscovery - %s already in your path but overwriting de-activated.\n', s_path);
  80. return;
  81. end
  82. end
  83. if ( b_recursive )
  84. addpath( genpath( s_path ) );
  85. else
  86. addpath( s_path );
  87. end
  88. end