TensorFlow函数:tf.image.decode_image

2018-05-25 11:19 更新

tf.image.decode_image函数

tf.image.decode_image(
    contents,
    channels=None,
    name=None
)

定义在:tensorflow/python/ops/image_ops_impl.py.

请参阅指南:图像操作>编码和解码

decode_bmp,decode_gif,decode_jpeg和decode_png的方便函数.

检测图像是否为BMP,GIF,JPEG或PNG,并执行相应的操作将输入字节string转换为类型uint8的Tensor.

注意: decode_gif返回一个4维数组[num_frames、高度、宽度、3],而不是decode_bmp、decode_jpeg和decode_png,后者返回3维数组[height, width, num_channels].如果您使用BMP、JPEG或PNG文件混合GIF文件,请确保在构造图表时考虑到这一点.

参数:

  • contents:0-D string,编码的图像字节.
  • channels:可选的int,默认为0,解码图像的颜色通道数量.
  • name:操作的名称(可选)

返回值:

对于BMP、JPEG和PNG图像,形状为[height, width, num_channels]或者对于GIF图像,形状为[num_frames, height, width, 3]的类型为uint8的Tensor.

可能引发的异常:

  • ValueError:通道数量不正确.
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy