qualitymse.hpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_QUALITY_QUALITYMSE_HPP
  5. #define OPENCV_QUALITY_QUALITYMSE_HPP
  6. #include "qualitybase.hpp"
  7. namespace cv
  8. {
  9. namespace quality
  10. {
  11. /**
  12. @brief Full reference mean square error algorithm https://en.wikipedia.org/wiki/Mean_squared_error
  13. */
  14. class CV_EXPORTS_W QualityMSE : public QualityBase {
  15. public:
  16. /** @brief Computes MSE for reference images supplied in class constructor and provided comparison images
  17. @param cmpImgs Comparison image(s)
  18. @returns cv::Scalar with per-channel quality values. Values range from 0 (best) to potentially max float (worst)
  19. */
  20. CV_WRAP cv::Scalar compute( InputArrayOfArrays cmpImgs ) CV_OVERRIDE;
  21. /** @brief Implements Algorithm::empty() */
  22. CV_WRAP bool empty() const CV_OVERRIDE { return _ref.empty() && QualityBase::empty(); }
  23. /** @brief Implements Algorithm::clear() */
  24. CV_WRAP void clear() CV_OVERRIDE { _ref = _mat_type(); QualityBase::clear(); }
  25. /**
  26. @brief Create an object which calculates quality
  27. @param ref input image to use as the reference for comparison
  28. */
  29. CV_WRAP static Ptr<QualityMSE> create(InputArray ref);
  30. /**
  31. @brief static method for computing quality
  32. @param ref reference image
  33. @param cmp comparison image=
  34. @param qualityMap output quality map, or cv::noArray()
  35. @returns cv::Scalar with per-channel quality values. Values range from 0 (best) to max float (worst)
  36. */
  37. CV_WRAP static cv::Scalar compute( InputArray ref, InputArray cmp, OutputArray qualityMap );
  38. protected:
  39. /** @brief Reference image, converted to internal mat type */
  40. QualityBase::_mat_type _ref;
  41. /**
  42. @brief Constructor
  43. @param ref reference image, converted to internal type
  44. */
  45. QualityMSE(QualityBase::_mat_type ref)
  46. : _ref(std::move(ref))
  47. {}
  48. }; // QualityMSE
  49. } // quality
  50. } // cv
  51. #endif