mindspore.ops.RGBToHSV

class mindspore.ops.RGBToHSV[source]

Convert one or more images from RGB to HSV. 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].

Note

Last dimension of input images must be size 3.

Inputs:
  • images (Tensor) - 1-D or higher rank RGB data Tensor to convert, last dimension must be size 3. Must be one of the following types: float16, float32, float64.

Outputs:

A Tensor, has the same type and shape as input images.

Raises
  • TypeError – If images is not tensor or its dtype is not float or double.

  • ValueError – If the rank of images is less than 1.

  • ValueError – If the last value of shape of images is not 3.

Supported Platforms:

GPU CPU

Examples

>>> images =  np.array([0.25, 0.5, 0.5]).astype(np.float32).reshape([1, 1, 1, 3])
>>> rgb_to_hsv = ops.RGBToHSV()
>>> output = rgb_to_hsv(Tensor(images))
>>> print(output)
[[[[0.5, 0.5, 0.5]]]]