OpenCV  4.10.0
Open Source Computer Vision
Loading...
Searching...
No Matches
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>

Public Member Functions

void clear () CV_OVERRIDE
 Implements Algorithm::clear().
cv::Scalar compute (InputArray cmp) CV_OVERRIDE
 Compute the PSNR.
bool empty () const CV_OVERRIDE
 Implements Algorithm::empty().
double getMaxPixelValue () const
 return the maximum pixel value used for PSNR computation
void setMaxPixelValue (double val)
 sets the maximum pixel value used for PSNR computation
Public Member Functions inherited from cv::quality::QualityBase
virtual ~QualityBase ()=default
 Destructor.
virtual void getQualityMap (OutputArray dst) const
 Returns output quality map that was generated during computation, if supported by the algorithm.
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.
virtual void save (const String &filename) const
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage.
void write (FileStorage &fs, const String &name) const

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
static Ptr< QualityPSNRcreate (InputArray ref, double maxPixelValue=QualityPSNR::MAX_PIXEL_VALUE_DEFAULT)
 Create an object which calculates quality.
Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp>
static Ptr< _Tpload (const String &filename, const String &objname=String())
 Loads algorithm from the file.
template<typename _Tp>
static Ptr< _TploadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String.
template<typename _Tp>
static Ptr< _Tpread (const FileNode &fn)
 Reads algorithm from the file node.

Static Public Attributes

static const int MAX_PIXEL_VALUE_DEFAULT = 255
 Default maximum pixel value.

Protected Member Functions

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

Static Protected Member Functions

static cv::Scalar _mse_to_psnr (cv::Scalar mse, double max_pixel_value)
static double _mse_to_psnr (double 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.

Additional Inherited Members

Protected Types inherited from cv::quality::QualityBase
using _mat_type = cv::UMat
 internal mat type default

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 )
inlineprotected

Constructor.

Member Function Documentation

◆ _mse_to_psnr() [1/2]

cv::Scalar cv::quality::QualityPSNR::_mse_to_psnr ( cv::Scalar mse,
double max_pixel_value )
inlinestaticprotected

◆ _mse_to_psnr() [2/2]

double cv::quality::QualityPSNR::_mse_to_psnr ( double mse,
double max_pixel_value )
inlinestaticprotected

◆ clear()

void cv::quality::QualityPSNR::clear ( )
inlinevirtual
Python:
cv.quality.QualityPSNR.clear() -> None

Implements Algorithm::clear().

Reimplemented from cv::quality::QualityBase.

◆ compute() [1/2]

cv::Scalar cv::quality::QualityPSNR::compute ( InputArray cmp)
inlinevirtual
Python:
cv.quality.QualityPSNR.compute(cmp) -> retval
cv.quality.QualityPSNR.compute(ref, cmp[, qualityMap[, maxPixelValue]]) -> retval, qualityMap
cv.quality.QualityPSNR_compute(ref, cmp[, qualityMap[, maxPixelValue]]) -> retval, qualityMap

Compute the PSNR.

Parameters
cmpComparison 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]

cv::Scalar cv::quality::QualityPSNR::compute ( InputArray ref,
InputArray cmp,
OutputArray qualityMap,
double maxPixelValue = QualityPSNR::MAX_PIXEL_VALUE_DEFAULT )
inlinestatic
Python:
cv.quality.QualityPSNR.compute(cmp) -> retval
cv.quality.QualityPSNR.compute(ref, cmp[, qualityMap[, maxPixelValue]]) -> retval, qualityMap
cv.quality.QualityPSNR_compute(ref, cmp[, qualityMap[, maxPixelValue]]) -> retval, qualityMap

static method for computing quality

Parameters
refreference image
cmpcomparison image
qualityMapoutput quality map, or cv::noArray()
maxPixelValuemaximum 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()

Ptr< QualityPSNR > cv::quality::QualityPSNR::create ( InputArray ref,
double maxPixelValue = QualityPSNR::MAX_PIXEL_VALUE_DEFAULT )
inlinestatic
Python:
cv.quality.QualityPSNR.create(ref[, maxPixelValue]) -> retval
cv.quality.QualityPSNR_create(ref[, maxPixelValue]) -> retval

Create an object which calculates quality.

Parameters
refinput image to use as the source for comparison
maxPixelValuemaximum per-channel value for any individual pixel; eg 255 for uint8 image

◆ empty()

bool cv::quality::QualityPSNR::empty ( ) const
inlinevirtual
Python:
cv.quality.QualityPSNR.empty() -> retval

Implements Algorithm::empty().

Reimplemented from cv::quality::QualityBase.

◆ getMaxPixelValue()

double cv::quality::QualityPSNR::getMaxPixelValue ( ) const
inline
Python:
cv.quality.QualityPSNR.getMaxPixelValue() -> retval

return the maximum pixel value used for PSNR computation

◆ setMaxPixelValue()

void cv::quality::QualityPSNR::setMaxPixelValue ( double val)
inline
Python:
cv.quality.QualityPSNR.setMaxPixelValue(val) -> None

sets the maximum pixel value used for PSNR computation

Parameters
valMaximum 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: