Compute peak signal-to-noise ratio (PSNR) between images
PSNR object computes the peak signal-to-noise
ratio (PSNR) between images. This ratio is often used as a quality
measurement between an original and a compressed image.
H = vision.PSNR returns
a System object,
H, that computes the peak signal-to-noise
ratio (PSNR) in decibels between two images.
|Code Generation Support|
|Supports MATLAB® Function block: Yes|
|System Objects in MATLAB Code Generation.|
|Code Generation Support, Usage Notes, and Limitations.|
|clone||Create peak signal to noise ratio object with same property values|
|getNumInputs||Number of expected inputs to step method|
|getNumOutputs||Number of outputs from step method|
|isLocked||Locked status for input attributes and non-tunable properties|
|release||Allow property value and input characteristics changes|
|step||Compute peak signal-to-noise ratio|
Compute the PSNR between an original image and its reconstructed image.
hdct2d = vision.DCT; hidct2d = vision.IDCT; hpsnr = vision.PSNR; I = double(imread('cameraman.tif')); J = step(hdct2d, I); J(abs(J) < 10) = 0; It = step(hidct2d, J); psnr = step(hpsnr, I,It) imshow(I, [0 255]), title('Original image'); figure, imshow(It,[0 255]), title('Reconstructed image');
This object implements the algorithm, inputs, and outputs described on the PSNR block reference page. The object properties correspond to the block parameters.