将一幅或多幅图像从 RGB 转换为 HSV。
用法
tf.image.rgb_to_hsv(
images, name=None
)参数
-
images一个Tensor。必须是以下类型之一:half,bfloat16,float32,float64。一维或更高等级。要转换的 RGB 数据。最后一个维度必须是大小 3。 -
name操作的名称(可选)。
返回
-
一个
Tensor。具有与images相同的类型。
输出与 images 张量形状相同的张量,包含像素的 HSV 值。仅当 images 中的值在 [0,1] 中时,输出才被明确定义。
output[..., 0] 包含色调,output[..., 1] 包含饱和度,output[..., 2] 包含值。所有 HSV 值都在 [0,1] 中。色调 0 对应于纯红色,色调 1/3 是纯绿色,2/3 是纯蓝色。
使用示例:
blue_image = tf.stack([
tf.zeros([5,5]),
tf.zeros([5,5]),
tf.ones([5,5])],
axis=-1)
blue_hsv_image = tf.image.rgb_to_hsv(blue_image)
blue_hsv_image[0,0].numpy()
array([0.6666667, 1. , 1. ], dtype=float32)
相关用法
- Python tf.image.rgb_to_yiq用法及代码示例
- Python tf.image.rgb_to_grayscale用法及代码示例
- Python tf.image.random_brightness用法及代码示例
- Python tf.image.random_contrast用法及代码示例
- Python tf.image.rot90用法及代码示例
- Python tf.image.random_hue用法及代码示例
- Python tf.image.random_saturation用法及代码示例
- Python tf.image.resize_with_crop_or_pad用法及代码示例
- Python tf.image.random_jpeg_quality用法及代码示例
- Python tf.image.random_flip_up_down用法及代码示例
- Python tf.image.random_crop用法及代码示例
- Python tf.image.resize用法及代码示例
- Python tf.image.random_flip_left_right用法及代码示例
- Python tf.image.pad_to_bounding_box用法及代码示例
- Python tf.image.adjust_hue用法及代码示例
- Python tf.image.flip_left_right用法及代码示例
- Python tf.image.convert_image_dtype用法及代码示例
- Python tf.image.stateless_random_flip_up_down用法及代码示例
- Python tf.image.extract_glimpse用法及代码示例
- Python tf.image.flip_up_down用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.image.rgb_to_hsv。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
