tf.image.ssim

tf.image.ssim(img1,img2,max_val)

Defined in?tensorflow/python/ops/image_ops_impl.py.

Computes SSIM index between img1 and img2.

This function is based on the standard SSIM implementation from: Wang, Z., Bovik, A. C., Sheikh, H. R., & Simoncelli, E. P. (2004). Image quality assessment: from error visibility to structural similarity. IEEE transactions on image processing.

Note:?The true SSIM is only defined on grayscale. This function does not perform any colorspace transform. (If input is already YUV, then it will compute YUV SSIM average.)

Details: - 11x11 Gaussian filter of width 1.5 is used. - k1 = 0.01, k2 = 0.03 as in the original paper.

The image sizes must be at least 11x11 because of the filter size.

Example:

? ? # Read images from file.

im1= tf.decode_png('path/to/im1.png')

im2= tf.decode_png('path/to/im2.png')# Compute SSIM over tf.uint8 Tensors.

ssim1= tf.image.ssim(im1, im2, max_val=255)

# Compute SSIM over tf.float32 Tensors.

im1= tf.image.convert_image_dtype(im1, tf.float32)

im2= tf.image.convert_image_dtype(im2, tf.float32)

ssim2= tf.image.ssim(im1, im2, max_val=1.0)# ssim1 and ssim2 both have type tf.float32 and are almost equal.

Args:

img1: First image batch.

img2: Second image batch.

max_val: The dynamic range of the images (i.e., the difference between the maximum the and minimum allowed values).

Returns:

A tensor containing an SSIM value for each image in batch. Returned SSIM values are in range (-1, 1], when pixel values are non-negative. Returns a tensor with shape: broadcast(img1.shape[:-3], img2.shape[:-3]).

Except as otherwise noted, the content of this page is licensed under the?Creative Commons Attribution 3.0 License, and code samples are licensed under the?Apache 2.0 License. For details, see our?Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

https://tensorflow.google.cn/api_docs/python/tf/image/ssim?hl=zh-cn

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • tf.image.psnr tf.image.psnr(a,b,max_val,name=None) Define...
    西方失敗9527閱讀 4,874評(píng)論 0 0
  • 有一絲涼意,讓自己醒來 也有那么一縷傷悲,不愿離去。 興奮的音樂,也難解救自己。 也許,真的想想。 自己應(yīng)該要什么...
    Joseph_KK閱讀 281評(píng)論 0 0
  • 當(dāng)無數(shù)的期待變成一次又一次的失望后,真的感覺不愛啦,而老公卻一點(diǎn)都不擔(dān)心我不愛他,反倒是我每次想到我不愛我老公變得...
    男神媽咪lily閱讀 514評(píng)論 0 0
  • 其實(shí)現(xiàn)在很多app都打著夸張的廣告,日賺萬(wàn)元,日賺千元的,不得不說有這樣的人,但是微乎其微,普通人怎么可能做得到網(wǎng)...
    貝貝快賺閱讀 7,842評(píng)論 0 51

友情鏈接更多精彩內(nèi)容