utility.hpp 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*M///////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
  4. //
  5. // By downloading, copying, installing or using the software you agree to this license.
  6. // If you do not agree to this license, do not download, install,
  7. // copy or use the software.
  8. //
  9. //
  10. // Intel License Agreement
  11. // For Open Source Computer Vision Library
  12. //
  13. // Copyright (C) 2000, Intel Corporation, all rights reserved.
  14. // Third party copyrights are property of their respective owners.
  15. //
  16. // Redistribution and use in source and binary forms, with or without modification,
  17. // are permitted provided that the following conditions are met:
  18. //
  19. // * Redistribution's of source code must retain the above copyright notice,
  20. // this list of conditions and the following disclaimer.
  21. //
  22. // * Redistribution's in binary form must reproduce the above copyright notice,
  23. // this list of conditions and the following disclaimer in the documentation
  24. // and/or other materials provided with the distribution.
  25. //
  26. // * The name of Intel Corporation may not be used to endorse or promote products
  27. // derived from this software without specific prior written permission.
  28. //
  29. // This software is provided by the copyright holders and contributors "as is" and
  30. // any express or implied warranties, including, but not limited to, the implied
  31. // warranties of merchantability and fitness for a particular purpose are disclaimed.
  32. // In no event shall the Intel Corporation or contributors be liable for any direct,
  33. // indirect, incidental, special, exemplary, or consequential damages
  34. // (including, but not limited to, procurement of substitute goods or services;
  35. // loss of use, data, or profits; or business interruption) however caused
  36. // and on any theory of liability, whether in contract, strict liability,
  37. // or tort (including negligence or otherwise) arising in any way out of
  38. // the use of this software, even if advised of the possibility of such damage.
  39. //
  40. //M*/
  41. #ifndef __CREATESAMPLES_UTILITY_HPP__
  42. #define __CREATESAMPLES_UTILITY_HPP__
  43. #define CV_VERBOSE 1
  44. /*
  45. * cvCreateTrainingSamples
  46. *
  47. * Create training samples applying random distortions to sample image and
  48. * store them in .vec file
  49. *
  50. * filename - .vec file name
  51. * imgfilename - sample image file name
  52. * bgcolor - background color for sample image
  53. * bgthreshold - background color threshold. Pixels those colors are in range
  54. * [bgcolor-bgthreshold, bgcolor+bgthreshold] are considered as transparent
  55. * bgfilename - background description file name. If not NULL samples
  56. * will be put on arbitrary background
  57. * count - desired number of samples
  58. * invert - if not 0 sample foreground pixels will be inverted
  59. * if invert == CV_RANDOM_INVERT then samples will be inverted randomly
  60. * maxintensitydev - desired max intensity deviation of foreground samples pixels
  61. * maxxangle - max rotation angles
  62. * maxyangle
  63. * maxzangle
  64. * showsamples - if not 0 samples will be shown
  65. * winwidth - desired samples width
  66. * winheight - desired samples height
  67. */
  68. #define CV_RANDOM_INVERT 0x7FFFFFFF
  69. void cvCreateTrainingSamples( const char* filename,
  70. const char* imgfilename, int bgcolor, int bgthreshold,
  71. const char* bgfilename, int count,
  72. int invert = 0, int maxintensitydev = 40,
  73. double maxxangle = 1.1,
  74. double maxyangle = 1.1,
  75. double maxzangle = 0.5,
  76. int showsamples = 0,
  77. int winwidth = 24, int winheight = 24 );
  78. void cvCreateTestSamples( const char* infoname,
  79. const char* imgfilename, int bgcolor, int bgthreshold,
  80. const char* bgfilename, int count,
  81. int invert, int maxintensitydev,
  82. double maxxangle, double maxyangle, double maxzangle,
  83. int showsamples,
  84. int winwidth, int winheight, double maxscale );
  85. /*
  86. * cvCreateTrainingSamplesFromInfo
  87. *
  88. * Create training samples from a set of marked up images and store them into .vec file
  89. * infoname - file in which marked up image descriptions are stored
  90. * num - desired number of samples
  91. * showsamples - if not 0 samples will be shown
  92. * winwidth - sample width
  93. * winheight - sample height
  94. *
  95. * Return number of successfully created samples
  96. */
  97. int cvCreateTrainingSamplesFromInfo( const char* infoname, const char* vecfilename,
  98. int num,
  99. int showsamples,
  100. int winwidth, int winheight );
  101. /*
  102. * cvShowVecSamples
  103. *
  104. * Shows samples stored in .vec file
  105. *
  106. * filename
  107. * .vec file name
  108. * winwidth
  109. * sample width
  110. * winheight
  111. * sample height
  112. * scale
  113. * the scale each sample is adjusted to
  114. */
  115. void cvShowVecSamples( const char* filename, int winwidth, int winheight, double scale );
  116. #endif //__CREATESAMPLES_UTILITY_HPP__