wolf
wolf

Reputation: 23

HSI color format in python with opencv library

Good morning, I was reviewing in python, along with Opencv, conversions to formats of different colors, but I do not find the HSI format, with the cv2.cvtColor() function.

Does anyone know if it matches the COLOR_BGR2HLS parameter?

Thank you for your attention

Upvotes: 0

Views: 4247

Answers (1)

Jeru Luke
Jeru Luke

Reputation: 21203

According to the Wikipedia article given HERE, the HSV, HLS and HSI color space terminology can be used interchangeably.

There is another option available in OpenCV as well cv2.cvtColor(img1,cv2.COLOR_BGR2HSV).

If you work out both the options, the resulting image would appear slightly different as in the following:

Using HSV:

enter image description here

Using HLS:

enter image description here

Now if you split the channels of these images (to split use cv2.split()) and analyze them:

  • The hue channel appears to be the same in both cases.
  • The saturation channel also provides the same result but appear to be switched.
  • You will notice a slight difference between the value channel of HSV image and the luminosity channel of the HLS image.

Work it out for an image and you will see for yourself.

HSV, HLS and HSI are similar not exactly same

Upvotes: 1

Related Questions