xobjdetect.hpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. By downloading, copying, installing or using the software you agree to this
  3. license. If you do not agree to this license, do not download, install,
  4. copy or use the software.
  5. License Agreement
  6. For Open Source Computer Vision Library
  7. (3-clause BSD License)
  8. Copyright (C) 2013, OpenCV Foundation, all rights reserved.
  9. Third party copyrights are property of their respective owners.
  10. Redistribution and use in source and binary forms, with or without modification,
  11. are permitted provided that the following conditions are met:
  12. * Redistributions of source code must retain the above copyright notice,
  13. this list of conditions and the following disclaimer.
  14. * Redistributions in binary form must reproduce the above copyright notice,
  15. this list of conditions and the following disclaimer in the documentation
  16. and/or other materials provided with the distribution.
  17. * Neither the names of the copyright holders nor the names of the contributors
  18. may be used to endorse or promote products derived from this software
  19. without specific prior written permission.
  20. This software is provided by the copyright holders and contributors "as is" and
  21. any express or implied warranties, including, but not limited to, the implied
  22. warranties of merchantability and fitness for a particular purpose are
  23. disclaimed. In no event shall copyright holders or contributors be liable for
  24. any direct, indirect, incidental, special, exemplary, or consequential damages
  25. (including, but not limited to, procurement of substitute goods or services;
  26. loss of use, data, or profits; or business interruption) however caused
  27. and on any theory of liability, whether in contract, strict liability,
  28. or tort (including negligence or otherwise) arising in any way out of
  29. the use of this software, even if advised of the possibility of such damage.
  30. */
  31. #ifndef __OPENCV_XOBJDETECT_XOBJDETECT_HPP__
  32. #define __OPENCV_XOBJDETECT_XOBJDETECT_HPP__
  33. #include <opencv2/core.hpp>
  34. #include <vector>
  35. #include <string>
  36. /** @defgroup xobjdetect Extended object detection
  37. */
  38. namespace cv
  39. {
  40. namespace xobjdetect
  41. {
  42. //! @addtogroup xobjdetect
  43. //! @{
  44. /** @brief WaldBoost detector
  45. */
  46. class CV_EXPORTS WBDetector {
  47. public:
  48. /** @brief Read detector from FileNode.
  49. @param node FileNode for input
  50. */
  51. virtual void read(const FileNode &node) = 0;
  52. /** @brief Write detector to FileStorage.
  53. @param fs FileStorage for output
  54. */
  55. virtual void write(FileStorage &fs) const = 0;
  56. /** @brief Train WaldBoost detector
  57. @param pos_samples Path to directory with cropped positive samples
  58. @param neg_imgs Path to directory with negative (background) images
  59. */
  60. virtual void train(
  61. const std::string& pos_samples,
  62. const std::string& neg_imgs) = 0;
  63. /** @brief Detect objects on image using WaldBoost detector
  64. @param img Input image for detection
  65. @param bboxes Bounding boxes coordinates output vector
  66. @param confidences Confidence values for bounding boxes output vector
  67. */
  68. virtual void detect(
  69. const Mat& img,
  70. std::vector<Rect> &bboxes,
  71. std::vector<double> &confidences) = 0;
  72. /** @brief Create instance of WBDetector
  73. */
  74. static Ptr<WBDetector> create();
  75. virtual ~WBDetector(){}
  76. };
  77. //! @}
  78. } /* namespace xobjdetect */
  79. } /* namespace cv */
  80. #endif /* __OPENCV_XOBJDETECT_XOBJDETECT_HPP__ */