qualitybase.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. #ifndef OPENCV_QUALITYBASE_HPP
  5. #define OPENCV_QUALITYBASE_HPP
  6. #include <opencv2/core.hpp>
  7. /**
  8. @defgroup quality Image Quality Analysis (IQA) API
  9. */
  10. namespace cv
  11. {
  12. namespace quality
  13. {
  14. //! @addtogroup quality
  15. //! @{
  16. /************************************ Quality Base Class ************************************/
  17. class CV_EXPORTS_W QualityBase
  18. : public virtual Algorithm
  19. {
  20. public:
  21. /** @brief Destructor */
  22. virtual ~QualityBase() = default;
  23. /**
  24. @brief Compute quality score per channel with the per-channel score in each element of the resulting cv::Scalar. See specific algorithm for interpreting result scores
  25. @param img comparison image, or image to evalute for no-reference quality algorithms
  26. */
  27. virtual CV_WRAP cv::Scalar compute( InputArray img ) = 0;
  28. /** @brief Returns output quality map that was generated during computation, if supported by the algorithm */
  29. virtual CV_WRAP void getQualityMap(OutputArray dst) const
  30. {
  31. if (!dst.needed() || _qualityMap.empty() )
  32. return;
  33. dst.assign(_qualityMap);
  34. }
  35. /** @brief Implements Algorithm::clear() */
  36. CV_WRAP void clear() CV_OVERRIDE { _qualityMap = _mat_type(); Algorithm::clear(); }
  37. /** @brief Implements Algorithm::empty() */
  38. CV_WRAP bool empty() const CV_OVERRIDE { return _qualityMap.empty(); }
  39. protected:
  40. /** @brief internal mat type default */
  41. using _mat_type = cv::UMat;
  42. /** @brief Output quality maps if generated by algorithm */
  43. _mat_type _qualityMap;
  44. }; // QualityBase
  45. //! @}
  46. } // quality
  47. } // cv
  48. #endif