Move rgb_to_hsv example.

PiperOrigin-RevId: 298404199
Change-Id: I1c1cb83d430c3f81681813704c6db74420d54529
This commit is contained in:
Mark Daoust 2020-03-02 11:37:25 -08:00 committed by TensorFlower Gardener
parent e82714b529
commit b55101409d
2 changed files with 12 additions and 11 deletions

View File

@ -21,5 +21,17 @@ are in `[0,1]`.
`output[..., 0]` contains hue, `output[..., 1]` contains saturation, and `output[..., 0]` contains hue, `output[..., 1]` contains saturation, and
`output[..., 2]` contains value. All HSV values are in `[0,1]`. A hue of 0 `output[..., 2]` contains value. All HSV values are in `[0,1]`. A hue of 0
corresponds to pure red, hue 1/3 is pure green, and 2/3 is pure blue. corresponds to pure red, hue 1/3 is pure green, and 2/3 is pure blue.
Usage Example:
>>> 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)
END END
} }

View File

@ -177,17 +177,6 @@ def _RGBToHSVGrad(op, grad):
separately before adding them in the end. Formulas are given before each separately before adding them in the end. Formulas are given before each
partial derivative calculation. partial derivative calculation.
Usage Example:
>>> rgb_image = tf.stack([
... tf.zeros([5,5]),
... tf.zeros([5,5]),
... tf.ones([5,5])],
... axis=-1)
>>> hsv_image = tf.image.rgb_to_hsv(rgb_image)
>>> hsv_image[1,1].numpy()
array([0.6666667, 1. , 1. ], dtype=float32)
Args: Args:
op: The `rgb_to_hsv` `Operation` that we are differentiating. op: The `rgb_to_hsv` `Operation` that we are differentiating.
grad: Gradient with respect to the output of the `rgb_to_hsv` op. grad: Gradient with respect to the output of the `rgb_to_hsv` op.