tensorflow::ops::DecodeAndCropJpeg

#include <image_ops.h>

Decode and Crop a JPEG-encoded image to a uint8 tensor.

Summary

The attr channels indicates the desired number of color channels for the decoded image.

Accepted values are:

  • 0: Use the number of channels in the JPEG-encoded image.
  • 1: output a grayscale image.
  • 3: output an RGB image.

If needed, the JPEG-encoded image is transformed to match the requested number of color channels.

The attr ratio allows downscaling the image by an integer factor during decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than downscaling the image later.

It is equivalent to a combination of decode and crop, but much faster by only decoding partial jpeg image.

Args:

  • scope: A Scope object
  • contents: 0-D. The JPEG-encoded image.
  • crop_window: 1-D. The crop window: [crop_y, crop_x, crop_height, crop_width].

Optional attributes (see Attrs):

  • channels: Number of color channels for the decoded image.
  • ratio: Downscaling ratio.
  • fancy_upscaling: If true use a slower but nicer upscaling of the chroma planes (yuv420/422 only).
  • try_recover_truncated: If true try to recover an image from truncated input.
  • acceptable_fraction: The minimum required fraction of lines before a truncated input is accepted.
  • dct_method: string specifying a hint about the algorithm used for decompression. Defaults to "" which maps to a system-specific default. Currently valid values are ["INTEGER_FAST", "INTEGER_ACCURATE"]. The hint may be ignored (e.g., the internal jpeg library changes to a version that does not have that specific option.)

Returns:

  • Output: 3-D with shape [height, width, channels]..

Constructors and Destructors

DecodeAndCropJpeg(const ::tensorflow::Scope & scope, ::tensorflow::Input contents, ::tensorflow::Input crop_window)
DecodeAndCropJpeg(const ::tensorflow::Scope & scope, ::tensorflow::Input contents, ::tensorflow::Input crop_window, const DecodeAndCropJpeg::Attrs & attrs)

Public attributes

image
operation

Public functions

node() const
::tensorflow::Node *
operator::tensorflow::Input() const
operator::tensorflow::Output() const

Public static functions

AcceptableFraction(float x)
Channels(int64 x)
DctMethod(StringPiece x)
FancyUpscaling(bool x)
Ratio(int64 x)
TryRecoverTruncated(bool x)

Structs

tensorflow::ops::DecodeAndCropJpeg::Attrs

Optional attribute setters for DecodeAndCropJpeg.

Public attributes

image

::tensorflow::Output image

operation

Operation operation

Public functions

DecodeAndCropJpeg

 DecodeAndCropJpeg(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input contents,
  ::tensorflow::Input crop_window
)

DecodeAndCropJpeg

 DecodeAndCropJpeg(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input contents,
  ::tensorflow::Input crop_window,
  const DecodeAndCropJpeg::Attrs & attrs
)

node

::tensorflow::Node * node() const 

operator::tensorflow::Input

 operator::tensorflow::Input() const 

operator::tensorflow::Output

 operator::tensorflow::Output() const 

Public static functions

AcceptableFraction

Attrs AcceptableFraction(
  float x
)

Channels

Attrs Channels(
  int64 x
)

DctMethod

Attrs DctMethod(
  StringPiece x
)

FancyUpscaling

Attrs FancyUpscaling(
  bool x
)

Ratio

Attrs Ratio(
  int64 x
)

TryRecoverTruncated

Attrs TryRecoverTruncated(
  bool x
)