DecodeJpeg


tensorflow C++ API

tensorflow::ops::DecodeJpeg

Decode a JPEG-encoded image to a uint8 tensor.


Summary

The attrchannelsindicates 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 attrratioallows 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.

This op also supports decoding PNGs and non-animated GIFs since the interface is the same, though it is cleaner to usetf.image.decode_image.

Arguments:

  • scope: A Scope object
  • contents: 0-D. The JPEG-encoded image.

Returns:

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

Optional attributes (seeAttrs):

  • 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.)

Constructor

  • DecodeJpeg(const ::tensorflow::Scope & scope, ::tensorflow::Input contents, const DecodeJpeg::Attrs & attrs) .

Public attributes

  • tensorflow::Output image.

DecodeJpeg block

Source link : https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_image_ops.cpp

Argument:

  • Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
  • contents : connect Input node.
  • DecodeJpeg::Attrs attrs : input attrs value. ex) channels_ = 3;ratio_ = 1;fancy_upscaling_ = true;try_recover_truncated_ = false;acceptable_fraction_ = 1.0f;dct_method_ = ;

Return:

  • Output image : Output object of DecodeJpeg class object.

Result:

  • std::vector(Tensor) product_result : Returned object of executed result by calling session.

Using Method

results matching ""

    No results matching ""