| OpenCV 4.3.0 Open Source Computer Vision

Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
cv::quality::QualityPSNR Class Reference

Full reference peak signal to noise ratio (PSNR) algorithm https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio. More...

`#include <opencv2/quality/qualitypsnr.hpp>`

Inheritance diagram for cv::quality::QualityPSNR:

## Public Member Functions
void | clear () CV_OVERRIDE
| Implements Algorithm::clear() More...
cv::Scalar | compute (InputArray cmp) CV_OVERRIDE
| Compute the PSNR. More...
bool | empty () const CV_OVERRIDE
| Implements Algorithm::empty() More...
double | getMaxPixelValue () const
| return the maximum pixel value used for PSNR computation More...
void | setMaxPixelValue (double val)
| sets the maximum pixel value used for PSNR computation More...
Public Member Functions inherited from cv::quality::QualityBase
virtual | ~QualityBase ()=default
| Destructor. More...
virtual void | getQualityMap (OutputArray dst) const
| Returns output quality map that was generated during computation, if supported by the algorithm. More...
Public Member Functions inherited from cv::Algorithm
| Algorithm ()
virtual | ~Algorithm ()
virtual String | getDefaultName () const
virtual void | read (const FileNode &fn)
| Reads algorithm parameters from a file storage. More...
virtual void | save (const String &filename) const
virtual void | write (FileStorage &fs) const
| Stores algorithm parameters in a file storage. More...
void | write (const Ptr< FileStorage > &fs, const String &name=String()) const
| simplified API for language bindings This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...

## Static Public Member Functions
static cv::Scalar | compute (InputArray ref, InputArray cmp, OutputArray qualityMap, double maxPixelValue=QualityPSNR::MAX_PIXEL_VALUE_DEFAULT)
| static method for computing quality More...
static Ptr< QualityPSNR > | create (InputArray ref, double maxPixelValue=QualityPSNR::MAX_PIXEL_VALUE_DEFAULT)
| Create an object which calculates quality. More...
Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tp > | load (const String &filename, const String &objname=String())
| Loads algorithm from the file. More...
template<typename _Tp >
static Ptr< _Tp > | loadFromString (const String &strModel, const String &objname=String())
| Loads algorithm from a String. More...
template<typename _Tp >
static Ptr< _Tp > | read (const FileNode &fn)
| Reads algorithm from the file node. More...

## Static Public Attributes
static const int | MAX_PIXEL_VALUE_DEFAULT = 255
| Default maximum pixel value. More...

## Protected Member Functions
| QualityPSNR (Ptr< QualityMSE > qualityMSE, double maxPixelValue)
| Constructor. More...
Protected Member Functions inherited from cv::Algorithm
void | writeFormat (FileStorage &fs) const

## Static Protected Member Functions
static double | _mse_to_psnr (double mse, double max_pixel_value)
static cv::Scalar | _mse_to_psnr (cv::Scalar mse, double max_pixel_value)

## Protected Attributes
double | _maxPixelValue = QualityPSNR::MAX_PIXEL_VALUE_DEFAULT
Ptr< QualityMSE > | _qualityMSE
Protected Attributes inherited from cv::quality::QualityBase
_mat_type | _qualityMap
| Output quality maps if generated by algorithm. More...

## Additional Inherited Members
Protected Types inherited from cv::quality::QualityBase
using | _mat_type = cv::UMat
| internal mat type default More...

## Detailed Description

Full reference peak signal to noise ratio (PSNR) algorithm https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio.

## Constructor & Destructor Documentation

## ◆ QualityPSNR()

cv::quality::QualityPSNR::QualityPSNR | ( | Ptr< QualityMSE > | qualityMSE,
|  | double | maxPixelValue
| ) |  |
| inline protected

Constructor.

## Member Function Documentation

## ◆ _mse_to_psnr() [1/2]

static double cv::quality::QualityPSNR::_mse_to_psnr | ( | double | mse,
|  | double | max_pixel_value
| ) |  |
| inline static protected

## ◆ _mse_to_psnr() [2/2]

static cv::Scalar cv::quality::QualityPSNR::_mse_to_psnr | ( | cv::Scalar | mse,
|  | double | max_pixel_value
| ) |  |
| inline static protected

## ◆ clear()

void cv::quality::QualityPSNR::clear | ( |  | ) |
| inline virtual

Python:
| None | = | cv.quality_QualityPSNR.clear( |  | )

Implements Algorithm::clear()

Reimplemented from cv::quality::QualityBase.

## ◆ compute() [1/2]

cv::Scalar cv::quality::QualityPSNR::compute | ( | InputArray | cmp | ) |
| inline virtual

Python:
| retval | = | cv.quality_QualityPSNR.compute( | cmp | )
| retval, qualityMap | = | cv.quality_QualityPSNR.compute( | ref, cmp[, qualityMap[, maxPixelValue]] | )
| retval, qualityMap | = | cv.quality.QualityPSNR_compute( | ref, cmp[, qualityMap[, maxPixelValue]] | )

Compute the PSNR.

Parameters

  cmp | Comparison image

Returns
  Per-channel PSNR value, or std::numeric_limits<double>::infinity() if the MSE between the two images == 0

Implements cv::quality::QualityBase.

## ◆ compute() [2/2]

static cv::Scalar cv::quality::QualityPSNR::compute | ( | InputArray | ref,
|  | InputArray | cmp,
|  | OutputArray | qualityMap,
|  | double | maxPixelValue = `QualityPSNR::MAX_PIXEL_VALUE_DEFAULT`
| ) |  |
| inline static

Python:
| retval | = | cv.quality_QualityPSNR.compute( | cmp | )
| retval, qualityMap | = | cv.quality_QualityPSNR.compute( | ref, cmp[, qualityMap[, maxPixelValue]] | )
| retval, qualityMap | = | cv.quality.QualityPSNR_compute( | ref, cmp[, qualityMap[, maxPixelValue]] | )

static method for computing quality

Parameters

  ref | reference image
  cmp | comparison image
  qualityMap | output quality map, or cv::noArray()
  maxPixelValue | maximum per-channel value for any individual pixel; eg 255 for uint8 image

Returns
  PSNR value, or std::numeric_limits<double>::infinity() if the MSE between the two images == 0

## ◆ create()

static Ptr<QualityPSNR> cv::quality::QualityPSNR::create | ( | InputArray | ref,
|  | double | maxPixelValue = `QualityPSNR::MAX_PIXEL_VALUE_DEFAULT`
| ) |  |
| inline static

Python:
| retval | = | cv.quality.QualityPSNR_create( | ref[, maxPixelValue] | )

Create an object which calculates quality.

Parameters

  ref | input image to use as the source for comparison
  maxPixelValue | maximum per-channel value for any individual pixel; eg 255 for uint8 image

## ◆ empty()

bool cv::quality::QualityPSNR::empty | ( |  | ) | const
| inline virtual

Python:
| retval | = | cv.quality_QualityPSNR.empty( |  | )

Implements Algorithm::empty()

Reimplemented from cv::quality::QualityBase.

## ◆ getMaxPixelValue()

double cv::quality::QualityPSNR::getMaxPixelValue | ( |  | ) | const
| inline

Python:
| retval | = | cv.quality_QualityPSNR.getMaxPixelValue( |  | )

return the maximum pixel value used for PSNR computation

## ◆ setMaxPixelValue()

void cv::quality::QualityPSNR::setMaxPixelValue | ( | double | val | ) |
| inline

Python:
| None | = | cv.quality_QualityPSNR.setMaxPixelValue( | val | )

sets the maximum pixel value used for PSNR computation

Parameters

  val | Maximum pixel value

## Member Data Documentation

## ◆ _maxPixelValue

double cv::quality::QualityPSNR::_maxPixelValue = QualityPSNR::MAX_PIXEL_VALUE_DEFAULT
| protected

## ◆ _qualityMSE

Ptr<QualityMSE> cv::quality::QualityPSNR::_qualityMSE
| protected

## ◆ MAX_PIXEL_VALUE_DEFAULT

const int cv::quality::QualityPSNR::MAX_PIXEL_VALUE_DEFAULT = 255
| static

Default maximum pixel value.

The documentation for this class was generated from the following file:

- opencv2/quality/qualitypsnr.hpp