Hello everyone, I was working on image segmentation (k means clustering based on colors) and I chose the HSV colorspace to select all the non-blue parts.

Now, I saw that by converting an image from RGB to HSV all the colors change, I took a look at the imshow() documentation and I found out that in any case this function read the image as BGR. So, my first question is: is it the only function acting like that? Does the others read the image as HSV? (I hope so, else I dont find the sense of this colorspace)…

My second question is: why the opencv HSV range is different from the others (e.g the Gimp one), and is there any way to find the blue values without using python?

Have a good day!

your expectations were misplaced. work to discover your assumptions, make them explicit, and investigate why your expectations don’t match reality.

matrices (cv::Mat, numpy array) only know how many channels the contained data uses, not what color space it is.

OpenCV’s usual assumption is that 3-channel color data has BGR order and values.

`imshow`

assumes that any 3-channel data is BGR. that goes for most other functions.

`cvtColor`

must be told explicitly what to do.

if you need `imshow`

to present data that is HSV, you need to `cvtColor`

it into BGR, so that imshow can present it properly.

the point of the HSV space is that it makes some operations simpler.

the HSV hue value for uint8 (CV_8U) data obviously can’t be 0…359 degrees, because that exceeds the value range of an uint8 (0…255), so OpenCV maps the “hue angle” to 0…179.