edgeboxes.hpp 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. // License Agreement
  11. // For Open Source Computer Vision Library
  12. //
  13. // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
  14. // Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
  15. // Third party copyrights are property of their respective owners.
  16. //
  17. // Redistribution and use in source and binary forms, with or without modification,
  18. // are permitted provided that the following conditions are met:
  19. //
  20. // * Redistribution's of source code must retain the above copyright notice,
  21. // this list of conditions and the following disclaimer.
  22. //
  23. // * Redistribution's in binary form must reproduce the above copyright notice,
  24. // this list of conditions and the following disclaimer in the documentation
  25. // and/or other materials provided with the distribution.
  26. //
  27. // * The name of the copyright holders may not be used to endorse or promote products
  28. // derived from this software without specific prior written permission.
  29. //
  30. // This software is provided by the copyright holders and contributors "as is" and
  31. // any express or implied warranties, including, but not limited to, the implied
  32. // warranties of merchantability and fitness for a particular purpose are disclaimed.
  33. // In no event shall the Intel Corporation or contributors be liable for any direct,
  34. // indirect, incidental, special, exemplary, or consequential damages
  35. // (including, but not limited to, procurement of substitute goods or services;
  36. // loss of use, data, or profits; or business interruption) however caused
  37. // and on any theory of liability, whether in contract, strict liability,
  38. // or tort (including negligence or otherwise) arising in any way out of
  39. // the use of this software, even if advised of the possibility of such damage.
  40. //
  41. //M*/
  42. #ifndef __OPENCV_EDGEBOXES_HPP__
  43. #define __OPENCV_EDGEBOXES_HPP__
  44. #include <opencv2/core.hpp>
  45. namespace cv
  46. {
  47. namespace ximgproc
  48. {
  49. //! @addtogroup ximgproc_edgeboxes
  50. //! @{
  51. // bounding box data structures
  52. typedef struct
  53. {
  54. int x, y, w, h;
  55. float score;
  56. } Box;
  57. typedef std::vector<Box> Boxes;
  58. /** @brief Class implementing EdgeBoxes algorithm from @cite ZitnickECCV14edgeBoxes :
  59. */
  60. class CV_EXPORTS_W EdgeBoxes : public Algorithm
  61. {
  62. public:
  63. /** @brief Returns array containing proposal boxes.
  64. @param edge_map edge image.
  65. @param orientation_map orientation map.
  66. @param boxes proposal boxes.
  67. */
  68. CV_WRAP virtual void getBoundingBoxes(InputArray edge_map, InputArray orientation_map, CV_OUT std::vector<Rect> &boxes) = 0;
  69. /** @brief Returns the step size of sliding window search.
  70. */
  71. CV_WRAP virtual float getAlpha() const = 0;
  72. /** @brief Sets the step size of sliding window search.
  73. */
  74. CV_WRAP virtual void setAlpha(float value) = 0;
  75. /** @brief Returns the nms threshold for object proposals.
  76. */
  77. CV_WRAP virtual float getBeta() const = 0;
  78. /** @brief Sets the nms threshold for object proposals.
  79. */
  80. CV_WRAP virtual void setBeta(float value) = 0;
  81. /** @brief Returns adaptation rate for nms threshold.
  82. */
  83. CV_WRAP virtual float getEta() const = 0;
  84. /** @brief Sets the adaptation rate for nms threshold.
  85. */
  86. CV_WRAP virtual void setEta(float value) = 0;
  87. /** @brief Returns the min score of boxes to detect.
  88. */
  89. CV_WRAP virtual float getMinScore() const = 0;
  90. /** @brief Sets the min score of boxes to detect.
  91. */
  92. CV_WRAP virtual void setMinScore(float value) = 0;
  93. /** @brief Returns the max number of boxes to detect.
  94. */
  95. CV_WRAP virtual int getMaxBoxes() const = 0;
  96. /** @brief Sets max number of boxes to detect.
  97. */
  98. CV_WRAP virtual void setMaxBoxes(int value) = 0;
  99. /** @brief Returns the edge min magnitude.
  100. */
  101. CV_WRAP virtual float getEdgeMinMag() const = 0;
  102. /** @brief Sets the edge min magnitude.
  103. */
  104. CV_WRAP virtual void setEdgeMinMag(float value) = 0;
  105. /** @brief Returns the edge merge threshold.
  106. */
  107. CV_WRAP virtual float getEdgeMergeThr() const = 0;
  108. /** @brief Sets the edge merge threshold.
  109. */
  110. CV_WRAP virtual void setEdgeMergeThr(float value) = 0;
  111. /** @brief Returns the cluster min magnitude.
  112. */
  113. CV_WRAP virtual float getClusterMinMag() const = 0;
  114. /** @brief Sets the cluster min magnitude.
  115. */
  116. CV_WRAP virtual void setClusterMinMag(float value) = 0;
  117. /** @brief Returns the max aspect ratio of boxes.
  118. */
  119. CV_WRAP virtual float getMaxAspectRatio() const = 0;
  120. /** @brief Sets the max aspect ratio of boxes.
  121. */
  122. CV_WRAP virtual void setMaxAspectRatio(float value) = 0;
  123. /** @brief Returns the minimum area of boxes.
  124. */
  125. CV_WRAP virtual float getMinBoxArea() const = 0;
  126. /** @brief Sets the minimum area of boxes.
  127. */
  128. CV_WRAP virtual void setMinBoxArea(float value) = 0;
  129. /** @brief Returns the affinity sensitivity.
  130. */
  131. CV_WRAP virtual float getGamma() const = 0;
  132. /** @brief Sets the affinity sensitivity
  133. */
  134. CV_WRAP virtual void setGamma(float value) = 0;
  135. /** @brief Returns the scale sensitivity.
  136. */
  137. CV_WRAP virtual float getKappa() const = 0;
  138. /** @brief Sets the scale sensitivity.
  139. */
  140. CV_WRAP virtual void setKappa(float value) = 0;
  141. };
  142. /** @brief Creates a Edgeboxes
  143. @param alpha step size of sliding window search.
  144. @param beta nms threshold for object proposals.
  145. @param eta adaptation rate for nms threshold.
  146. @param minScore min score of boxes to detect.
  147. @param maxBoxes max number of boxes to detect.
  148. @param edgeMinMag edge min magnitude. Increase to trade off accuracy for speed.
  149. @param edgeMergeThr edge merge threshold. Increase to trade off accuracy for speed.
  150. @param clusterMinMag cluster min magnitude. Increase to trade off accuracy for speed.
  151. @param maxAspectRatio max aspect ratio of boxes.
  152. @param minBoxArea minimum area of boxes.
  153. @param gamma affinity sensitivity.
  154. @param kappa scale sensitivity.
  155. */
  156. CV_EXPORTS_W Ptr<EdgeBoxes>
  157. createEdgeBoxes(float alpha=0.65f,
  158. float beta=0.75f,
  159. float eta=1,
  160. float minScore=0.01f,
  161. int maxBoxes=10000,
  162. float edgeMinMag=0.1f,
  163. float edgeMergeThr=0.5f,
  164. float clusterMinMag=0.5f,
  165. float maxAspectRatio=3,
  166. float minBoxArea=1000,
  167. float gamma=2,
  168. float kappa=1.5f);
  169. //! @}
  170. }
  171. }
  172. #endif /* __OPENCV_EDGEBOXES_HPP__ */