mindspore.ops.HSVToRGB

class mindspore.ops.HSVToRGB[source]

Convert one or more images from HSV to RGB. Outputs a tensor of the same shape as the images tensor, containing the HSV value of the pixels. The output is only well defined if the value in images are in [0,1].

Inputs:
  • x (Tensor) - The input image must be a 4-D tensor of shape \([batch, image\_height, image\_width, channel]\). Number of channel must be 3. Types allowed: float16, float32, float64.

Outputs:

A 4-D tensor of shape \([batch, image\_height, image\_width, channel]\) with same type of input.

Raises
  • TypeError – If x is not a Tensor.

  • TypeError – If the dtype of x is not float16, float32, float64.

  • ValueError – If rank of the x is not equal to 4.

  • ValueError – If the last dimension of x is not equal to 3.

Supported Platforms:

GPU CPU

Examples

>>> image = np.array([0.5, 0.5, 0.5]).astype(np.float32).reshape([1, 1, 1, 3])
>>> hsv_to_rgb = ops.HSVToRGB()
>>> output = hsv_to_rgb(Tensor(image))
>>> print(output)
[[[[0.25 0.5  0.5 ]]]]