Move rgb_to_hsv example.
PiperOrigin-RevId: 298404199 Change-Id: I1c1cb83d430c3f81681813704c6db74420d54529
This commit is contained in:
parent
e82714b529
commit
b55101409d
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user