 Quality - Maple Help

ImageTools

 Quality
 compute the quality measure of a reconstructed image Calling Sequence Quality( img_r, img_s, meas, opts ) Parameters

 img_r - Image; reconstructed image img_s - Image; source image meas - (optional) name; quality measure opts - (optional) equation(s) of the form option = value; specify options for the Quality command Options

 • peak = realcons
 Specifies the peak value to use for the peak signal-to-noise ratio (psnr) calculation. It is ignored for the other cases. The default is 1. Description

 • The Quality command computes the quality measure of a reconstructed image with respect to a source image.
 • The img_r and img_s parameters are the reconstructed and the source images, respectively. They must be grayscale images and have the same width, height, and order (C_order or Fortran_order). Quality Measures

 The optional meas parameter is a name specifying the quality measure. It can take one of the following values, the default is mse:
 • mse:  mean-squared error. $\mathrm{mse}=\frac{\mathrm{sum}\left({\left({r}_{i,j}-{s}_{i,j}\right)}^{2}\right)}{wh}$, where $r,s$ are the reconstructed and source images, $i,j$ range over all pixels, and $w,h$ are the width and height.
 • rmse: root-mean-squared error (rms). $\mathrm{rmse}=\sqrt{\mathrm{mse}}$.
 • snr: signal-to-noise ratio. $\mathrm{snr}=10{\mathrm{log}}_{10}\left(\frac{\mathrm{sum}\left({s}_{i,j}^{2}\right)}{wh\mathrm{mse}}\right)$.
 • psnr: peak signal-to-noise ratio. $\mathrm{psnr}=10{\mathrm{log}}_{10}\left(\frac{{\mathrm{peak}}^{2}}{\mathrm{mse}}\right)$. Examples

 > $\mathrm{with}\left(\mathrm{ImageTools}\right):$
 > $\mathrm{img_s}≔\mathrm{Create}\left(100,200,\left(r,c\right)↦\mathrm{evalf}\left(0.5\cdot \mathrm{sin}\left(\frac{r}{50}\right)+0.5\cdot \mathrm{sin}\left(\frac{c}{30}\right)\right)\right):$
 > $\mathrm{img_r}≔0.99\mathrm{img_s}+0.01:$
 > $\mathrm{Quality}\left(\mathrm{img_r},\mathrm{img_s},\mathrm{psnr}\right)$
 ${42.61176831}$ (1)
 > $\mathrm{Quality}\left(\mathrm{img_r},\mathrm{img_s},\mathrm{snr}\right)$
 ${36.96510324}$ (2)
 > $\mathrm{Quality}\left(\mathrm{img_r},\mathrm{img_s},\mathrm{rmse}\right)$
 ${0.007403065375}$ (3)
 > $\mathrm{Quality}\left(\mathrm{img_r},\mathrm{img_s},\mathrm{mse}\right)$
 ${0.0000548053769525598726}$ (4)