tf.image.rgb_to_grayscale(images, name=None)
See the guide: Images > Converting Between Colorspaces
Converts one or more images from RGB to Grayscale.
Outputs a tensor of the same DType
and rank as images
. The size of the last dimension of the output is 1, containing the Grayscale value of the pixels.
images
: The RGB tensor to convert. Last dimension must have size 3 and should contain RGB values.name
: A name for the operation (optional).The converted grayscale image(s).
Defined in tensorflow/python/ops/image_ops_impl.py
.
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/image/rgb_to_grayscale