Have a question? Connect with the community at the TensorFlow Forum Visit Forum

DecodeAndCropJpeg

public final class DecodeAndCropJpeg

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

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.

Nested Classes

class DecodeAndCropJpeg.Options Optional attributes for DecodeAndCropJpeg

Constants

String OP_NAME The name of this op, as known by TensorFlow core engine

Public Methods

static DecodeAndCropJpeg.Options
acceptableFraction (Float acceptableFraction)
Output < TUint8 >
asOutput ()
Returns the symbolic handle of the tensor.
static DecodeAndCropJpeg.Options
channels (Long channels)
static DecodeAndCropJpeg
create ( Scope scope, Operand < TString > contents, Operand < TInt32 > cropWindow, Options... options)
Factory method to create a class wrapping a new DecodeAndCropJpeg operation.
static DecodeAndCropJpeg.Options
dctMethod (String dctMethod)
static DecodeAndCropJpeg.Options
fancyUpscaling (Boolean fancyUpscaling)
Output < TUint8 >
image ()
3-D with shape `[height, width, channels]`..
static DecodeAndCropJpeg.Options
ratio (Long ratio)
static DecodeAndCropJpeg.Options
tryRecoverTruncated (Boolean tryRecoverTruncated)

Inherited Methods

Constants

public static final String OP_NAME

The name of this op, as known by TensorFlow core engine

Constant Value: "DecodeAndCropJpeg"

Public Methods

public static DecodeAndCropJpeg.Options acceptableFraction (Float acceptableFraction)

Parameters
acceptableFraction The minimum required fraction of lines before a truncated input is accepted.

public Output < TUint8 > asOutput ()

Returns the symbolic handle of the tensor.

Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.

public static DecodeAndCropJpeg.Options channels (Long channels)

Parameters
channels Number of color channels for the decoded image.

public static DecodeAndCropJpeg create ( Scope scope, Operand < TString > contents, Operand < TInt32 > cropWindow, Options... options)

Factory method to create a class wrapping a new DecodeAndCropJpeg operation.

Parameters
scope current scope
contents 0-D. The JPEG-encoded image.
cropWindow 1-D. The crop window: [crop_y, crop_x, crop_height, crop_width].
options carries optional attributes values
Returns
  • a new instance of DecodeAndCropJpeg

public static DecodeAndCropJpeg.Options dctMethod (String dctMethod)

Parameters
dctMethod 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.)

public static DecodeAndCropJpeg.Options fancyUpscaling (Boolean fancyUpscaling)

Parameters
fancyUpscaling If true use a slower but nicer upscaling of the chroma planes (yuv420/422 only).

public Output < TUint8 > image ()

3-D with shape `[height, width, channels]`..

public static DecodeAndCropJpeg.Options ratio (Long ratio)

Parameters
ratio Downscaling ratio.

public static DecodeAndCropJpeg.Options tryRecoverTruncated (Boolean tryRecoverTruncated)

Parameters
tryRecoverTruncated If true try to recover an image from truncated input.