T 6

2019-01-31  本文已影响0人  sumpig

class tf.gfile.GFile

__init__(
    name,
    mode='r'
)
with tf.gfile.GFile("/path/output", "wb") as f:
    f.write(image)

tf.image.decode_jpeg

tf.image.decode_jpeg(
    contents,
    channels=0,
    ratio=1,
    fancy_upscaling=True,
    try_recover_truncated=False,
    acceptable_fraction=1,
    dct_method='',
    name=None
)
image_data = tf.image.decode_jpeg(image_raw_data)
tf.image.encode_jpeg(
    image,
    format='',
    quality=95,
    progressive=False,
    optimize_size=False,
    chroma_downsampling=True,
    density_unit='in',
    x_density=300,
    y_density=300,
    xmp_metadata='',
    name=None
)

tf.image.resize_images

tf.image.resize_images(
    images,
    size,
    method=ResizeMethod.BILINEAR,
    align_corners=False,
    preserve_aspect_ratio=False
)

images: 4-D[batch, height, width, channels] 或 3-D[height, width, channels];
size: 图像的新大小;
method
ResizeMethod.BILINEAR:双线性插值。
ResizeMethod.NEAREST_NEIGHBOR:最近邻插值。
ResizeMethod.BICUBIC:双立方插值。
ResizeMethod.AREA:区域插值。

resized = tf.image.resize_images(img_data, [300, 300], method=0)

tf.image.resize_image_with_crop_or_pad

tf.image.resize_image_with_crop_or_pad(
    image,
    target_height,
    target_width
)
croped_or_padded = tf.image.resize_image_with_crop_or_pad(
    img_data, 1000, 1000)

tf.image.central_crop

tf.image.central_crop(
    image,
    central_fraction
)

central_fraction:裁剪比例;

central_cropped = tf.image.central_crop(img_data, 0.5)

上一篇下一篇

猜你喜欢

热点阅读