將一幅或多幅圖像從灰度轉換為 RGB。
用法
tf.image.grayscale_to_rgb(
images, name=None
)
參數
-
images
要轉換的灰度張量。最後一個維度的大小必須為 1。 -
name
操作的名稱(可選)。
返回
- 轉換後的灰度圖像。
輸出相同的張量 DType
並排名為 images
。輸出的最後一個維度的大小為 3,包含像素的 RGB 值。輸入圖像的最後一個維度必須為 1。
original = tf.constant([[[1.0], [2.0], [3.0]]])
converted = tf.image.grayscale_to_rgb(original)
print(converted.numpy())
[[[1. 1. 1.]
[2. 2. 2.]
[3. 3. 3.]]]
相關用法
- Python tf.image.random_brightness用法及代碼示例
- Python tf.image.pad_to_bounding_box用法及代碼示例
- Python tf.image.adjust_hue用法及代碼示例
- Python tf.image.random_contrast用法及代碼示例
- Python tf.image.rot90用法及代碼示例
- Python tf.image.random_hue用法及代碼示例
- Python tf.image.flip_left_right用法及代碼示例
- Python tf.image.convert_image_dtype用法及代碼示例
- Python tf.image.stateless_random_flip_up_down用法及代碼示例
- Python tf.image.random_saturation用法及代碼示例
- Python tf.image.extract_glimpse用法及代碼示例
- Python tf.image.flip_up_down用法及代碼示例
- Python tf.image.crop_to_bounding_box用法及代碼示例
- Python tf.image.stateless_random_jpeg_quality用法及代碼示例
- Python tf.image.crop_and_resize用法及代碼示例
- Python tf.image.psnr用法及代碼示例
- Python tf.image.stateless_random_hue用法及代碼示例
- Python tf.image.rgb_to_yiq用法及代碼示例
- Python tf.image.stateless_random_crop用法及代碼示例
- Python tf.image.resize_with_crop_or_pad用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.image.grayscale_to_rgb。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。