tfmri.image.psnr2d
tfmri.image.psnr2d¶
- psnr2d(img1, img2, max_val=None, name='psnr2d')[source]¶
Computes the peak signal-to-noise ratio (PSNR) between two 2D images.
This function operates on batches of multi-channel inputs and returns a PSNR value for each image in the batch.
- Parameters
img1 – A
Tensor
. First batch of images. Must have rank >= 3 with shapebatch_shape + [height, width, channels]
. Can have integer or floating point type, with values in the range[0, max_val]
.img2 – A
Tensor
. Second batch of images. Must have rank >= 3 with shapebatch_shape + [height, width, channels]
. Can have integer or floating point type, with values in the range[0, max_val]
.max_val – The dynamic range of the images (i.e., the difference between the maximum and the minimum allowed values). Defaults to 1 for floating point input images and
MAX
for integer input images, whereMAX
is the largest positive representable number for the data type.name – Namespace to embed the computation in.
- Returns
The scalar PSNR between
img1
andimg2
. The returned tensor has typetf.float32
and shapebatch_shape
.