EncodeJpeg
tensorflow C++ API
JPEG-encode an image.
Summary
image
is a 3-D uint8Tensorof shape[height, width, channels]
.The attrformat
can be used to override the color format of the encoded output. Values can be:
Use a default format based on the number of channels in the image. *
grayscale:
Output
a grayscale JPEG image. The
channelsdimension of
imagemust be 1. *
rgb:
Output
an RGB JPEG image. The
channelsdimension of
image` must be 3.
Ifformat
is not specified or is the empty string, a default format is picked in function of the number of channels inimage
:
Arguments:
- scope: A Scope object
- image: 3-D with shape [height, width, channels].
Returns:
Output
: 0-D. JPEG-encoded image.
Optional attributes (seeAttrs
):
- format: Per pixel image format.
- quality: Quality of the compression from 0 to 100 (higher is better and slower).
- progressive: If True, create a JPEG that loads progressively (coarse to fine).
- optimize_size: If True, spend CPU/RAM to reduce size with no quality change.
- chroma_downsampling: See http://en.wikipedia.org/wiki/Chroma_subsampling.
- density_unit: Unit used to specify
x_density
andy_density
: pixels per inch ('in'
) or centimeter ('cm'
). - x_density: Horizontal pixels per density unit.
- y_density: Vertical pixels per density unit.
- xmp_metadata: If not empty, embed this XMP metadata in the image header.
Constructor
- EncodeJpeg(const ::tensorflow::Scope & scope, ::tensorflow::Input image, const EncodeJpeg::Attrs & attrs) .
Public attributes
- tensorflow::Output contents.
EncodeJpeg 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.)
- image: connect Input node.
- EncodeJpeg::Attrs attrs : input attrs value. ex) format_ = ;quality_ = 95;progressive_ = false;optimize_size_ = false;chroma_downsampling_ = true;density_unit_ = in;x_density_ = 300;y_density_ = 300;xmp_metadata_ = ;
Return:
- Output contents : Output object of EncodeJpeg class object.
Result:
- std::vector(Tensor) product_result : Returned object of executed result by calling session.