Skip to content

quality_QualityPSNR

qualityclassOpenCV 5.0.0
import { quality_QualityPSNR } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits quality_QualityBase.

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

Constructors and members

static create

Create an object which calculates quality

create(ref: Mat, maxPixelValue: number): quality_QualityPSNR | null;
2 available overloads
create(ref: Mat): quality_QualityPSNR | null;
create(ref: Mat, maxPixelValue: number): quality_QualityPSNR | null;
ref

input image to use as the source for comparison

maxPixelValue

maximum per-channel value for any individual pixel; eg 255 for uint8 image

Returns

The quality_QualityPSNR | null result.

static compute1

static method for computing quality

compute1(ref: Mat, cmp: Mat, qualityMap: Mat, maxPixelValue: number): Scalar;
2 available overloads
compute1(ref: Mat, cmp: Mat, qualityMap: Mat): Scalar;
compute1(ref: Mat, cmp: Mat, qualityMap: Mat, maxPixelValue: number): Scalar;
ref

reference image

cmp

comparison image

qualityMap

Output destination, filled by the native operation. 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

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

compute

Compute the PSNR

compute(cmp: Mat): Scalar;
cmp

Comparison image

Returns

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

empty

Implements Algorithm::empty()

empty(): boolean;
Returns

The boolean result.

clear

Implements Algorithm::clear()

clear(): void;

getMaxPixelValue

return the maximum pixel value used for PSNR computation

getMaxPixelValue(): number;
Returns

The number result.

setMaxPixelValue

sets the maximum pixel value used for PSNR computation

setMaxPixelValue(val: number): void;
val

Maximum pixel value

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.